Commit 95a7a26dd089804e3a2fb6e806471066f3db09b3

alias :context :describe in example_group_methods. Closes #312.

Commit diff

rspec/CHANGES

 
55used it, and they will now break. Just replace the metaclass call with (class << self; self; end)
66and all will be well.
77
8* alias :context :describe in example_group_methods. Closes #312.
89* Applied patch from Ben Mabey to make the Story runner exit with a non-0 exit code on failing stories. Closes #228.
910* Added #helper and #assigns to helper specs.
1011* Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162.
toggle raw diff

rspec/lib/spec/example/example_group_methods.rb

 
5252 self
5353 end
5454 end
55 alias :context :describe
5556
5657 # Use this to pull in examples from shared example groups.
5758 # See Spec::Runner for information about shared example groups.
toggle raw diff

rspec/spec/spec/example/example_group_methods_spec.rb

 
2424 ExampleGroup.reset
2525 end
2626
27 describe "#describe" do
28 describe "when creating an ExampleGroup" do
29 attr_reader :child_example_group
30 before do
31 @child_example_group = @example_group.describe("Another ExampleGroup") do
32 it "should pass" do
33 true.should be_true
27 ["describe","context"].each do |method|
28 describe "#{method}" do
29 describe "when creating an ExampleGroup" do
30 attr_reader :child_example_group
31 before do
32 @child_example_group = @example_group.send method, "Another ExampleGroup" do
33 it "should pass" do
34 true.should be_true
35 end
3436 end
3537 end
36 end
3738
38 it "should create a subclass of the ExampleGroup when passed a block" do
39 child_example_group.superclass.should == @example_group
40 @options.example_groups.should include(child_example_group)
41 end
39 it "should create a subclass of the ExampleGroup when passed a block" do
40 child_example_group.superclass.should == @example_group
41 @options.example_groups.should include(child_example_group)
42 end
4243
43 it "should not inherit examples" do
44 child_example_group.examples.length.should == 1
44 it "should not inherit examples" do
45 child_example_group.examples.length.should == 1
46 end
4547 end
46 end
4748
48 describe "when creating a SharedExampleGroup" do
49 attr_reader :name, :shared_example_group
50 before do
51 @name = "A Shared ExampleGroup"
52 @shared_example_group = @example_group.describe(name, :shared => true) do
53 it "should pass" do
54 true.should be_true
49 describe "when creating a SharedExampleGroup" do
50 attr_reader :name, :shared_example_group
51 before do
52 @name = "A Shared ExampleGroup"
53 @shared_example_group = @example_group.send method, name, :shared => true do
54 it "should pass" do
55 true.should be_true
56 end
5557 end
5658 end
57 end
5859
59 after do
60 SharedExampleGroup.shared_example_groups.delete_if do |registered_shared_example_group|
61 registered_shared_example_group == shared_example_group
60 after do
61 SharedExampleGroup.shared_example_groups.delete_if do |registered_shared_example_group|
62 registered_shared_example_group == shared_example_group
63 end
6264 end
63 end
6465
65 it "should create a SharedExampleGroup" do
66 SharedExampleGroup.find_shared_example_group(name).should == shared_example_group
66 it "should create a SharedExampleGroup" do
67 SharedExampleGroup.find_shared_example_group(name).should == shared_example_group
68 end
6769 end
68 end
6970
71 end
7072 end
71
73
7274 describe "#it" do
7375 it "should should create an example instance" do
7476 lambda {
toggle raw diff