describe(*args, &example_group_block)
public
Makes the describe/it syntax available from a class. For example:
class StackSpec < Spec::ExampleGroup
describe Stack, "with no elements"
before
@stack = Stack.new
end
it "should raise on pop" do
lambda{ @stack.pop }.should raise_error
end
end
Show source
def describe(*args, &example_group_block)
args << {} unless Hash === args.last
if example_group_block
params = args.last
params[:spec_path] = eval("caller(0)[1]", example_group_block) unless params[:spec_path]
if params[:shared]
SharedExampleGroup.new(*args, &example_group_block)
else
self.subclass("Subclass") do
describe(*args)
module_eval(&example_group_block)
end
end
else
set_description(*args)
before_eval
self
end
end