| |   |
| 5 | 5 | used it, and they will now break. Just replace the metaclass call with (class << self; self; end) |
| 6 | 6 | and all will be well. |
| 7 | 7 | |
| 8 | * alias :context :describe in example_group_methods. Closes #312. |
| 8 | 9 | * Applied patch from Ben Mabey to make the Story runner exit with a non-0 exit code on failing stories. Closes #228. |
| 9 | 10 | * Added #helper and #assigns to helper specs. |
| 10 | 11 | * Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162. |
| toggle raw diff |
--- a/rspec/CHANGES
+++ b/rspec/CHANGES
@@ -5,6 +5,7 @@ Note: we've removed the metaclass method from Object. There were some generated
used it, and they will now break. Just replace the metaclass call with (class << self; self; end)
and all will be well.
+* alias :context :describe in example_group_methods. Closes #312.
* Applied patch from Ben Mabey to make the Story runner exit with a non-0 exit code on failing stories. Closes #228.
* Added #helper and #assigns to helper specs.
* Applied patch from Bryan Helmkamp to tweak format of generated spec.opts to be more obvious. Closes #162. |
| |   |
| 24 | 24 | ExampleGroup.reset |
| 25 | 25 | end |
| 26 | 26 | |
| 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 |
| 34 | 36 | end |
| 35 | 37 | end |
| 36 | | end |
| 37 | 38 | |
| 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 |
| 42 | 43 | |
| 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 |
| 45 | 47 | end |
| 46 | | end |
| 47 | 48 | |
| 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 |
| 55 | 57 | end |
| 56 | 58 | end |
| 57 | | end |
| 58 | 59 | |
| 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 |
| 62 | 64 | end |
| 63 | | end |
| 64 | 65 | |
| 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 |
| 67 | 69 | end |
| 68 | | end |
| 69 | 70 | |
| 71 | end |
| 70 | 72 | end |
| 71 | | |
| 73 | |
| 72 | 74 | describe "#it" do |
| 73 | 75 | it "should should create an example instance" do |
| 74 | 76 | lambda { |
| toggle raw diff |
--- a/rspec/spec/spec/example/example_group_methods_spec.rb
+++ b/rspec/spec/spec/example/example_group_methods_spec.rb
@@ -24,51 +24,53 @@ module Spec
ExampleGroup.reset
end
- describe "#describe" do
- describe "when creating an ExampleGroup" do
- attr_reader :child_example_group
- before do
- @child_example_group = @example_group.describe("Another ExampleGroup") do
- it "should pass" do
- true.should be_true
+ ["describe","context"].each do |method|
+ describe "#{method}" do
+ describe "when creating an ExampleGroup" do
+ attr_reader :child_example_group
+ before do
+ @child_example_group = @example_group.send method, "Another ExampleGroup" do
+ it "should pass" do
+ true.should be_true
+ end
end
end
- end
- it "should create a subclass of the ExampleGroup when passed a block" do
- child_example_group.superclass.should == @example_group
- @options.example_groups.should include(child_example_group)
- end
+ it "should create a subclass of the ExampleGroup when passed a block" do
+ child_example_group.superclass.should == @example_group
+ @options.example_groups.should include(child_example_group)
+ end
- it "should not inherit examples" do
- child_example_group.examples.length.should == 1
+ it "should not inherit examples" do
+ child_example_group.examples.length.should == 1
+ end
end
- end
- describe "when creating a SharedExampleGroup" do
- attr_reader :name, :shared_example_group
- before do
- @name = "A Shared ExampleGroup"
- @shared_example_group = @example_group.describe(name, :shared => true) do
- it "should pass" do
- true.should be_true
+ describe "when creating a SharedExampleGroup" do
+ attr_reader :name, :shared_example_group
+ before do
+ @name = "A Shared ExampleGroup"
+ @shared_example_group = @example_group.send method, name, :shared => true do
+ it "should pass" do
+ true.should be_true
+ end
end
end
- end
- after do
- SharedExampleGroup.shared_example_groups.delete_if do |registered_shared_example_group|
- registered_shared_example_group == shared_example_group
+ after do
+ SharedExampleGroup.shared_example_groups.delete_if do |registered_shared_example_group|
+ registered_shared_example_group == shared_example_group
+ end
end
- end
- it "should create a SharedExampleGroup" do
- SharedExampleGroup.find_shared_example_group(name).should == shared_example_group
+ it "should create a SharedExampleGroup" do
+ SharedExampleGroup.find_shared_example_group(name).should == shared_example_group
+ end
end
- end
+ end
end
-
+
describe "#it" do
it "should should create an example instance" do
lambda { |