150: def it_should_behave_like(desc)
151: return if MSpec.guarded?
152:
153: unless state = MSpec.retrieve_shared(desc)
154: raise Exception, "Unable to find shared 'describe' for #{desc}"
155: end
156:
157: state.before(:all).each { |b| before :all, &b }
158: state.before(:each).each { |b| before :each, &b }
159: state.after(:each).each { |b| after :each, &b }
160: state.after(:all).each { |b| after :all, &b }
161:
162: state.examples.each do |example|
163: example = example.dup
164: example.context = self
165: @examples << example
166: end
167:
168: state.children.each do |child|
169: child.dup.adopt self
170: end
171: end