Browse files

move features to rspec-expectations

  • Loading branch information...
1 parent e3806a8 commit de2d01003203d3f338db4b27e711b947eab5bb44 @dchelimsky dchelimsky committed Mar 7, 2010
View
59 features-pending/example_groups/implicit_docstrings.feature
@@ -1,59 +0,0 @@
-Feature: implicit docstrings
-
- As an RSpec user
- I want examples to generate their own names
- So that I can reduce duplication between example names and example code
-
- Scenario Outline: run passing examples
- Given a file named "implicit_docstrings_example.rb" with:
- """
- require 'rspec/autorun'
- describe "Examples with no docstrings generate their own:" do
-
- specify { 3.should be < 5 }
-
- specify { ["a"].should include("a") }
-
- specify { [1,2,3].should respond_to(:size) }
-
- end
- """
-
- When I run "<Command> implicit_docstrings_example.rb -fs"
-
- Then the stdout should match /should be < 5/
- And the stdout should match /should include "a"/
- And the stdout should match /should respond to #size/
-
- Scenarios: Run with ruby and spec
- | Command |
- | ruby |
- | spec |
-
- Scenario Outline: run failing examples
- Given a file named "failing_implicit_docstrings_example.rb" with:
- """
- require 'rspec/autorun'
- describe "Failing examples with no descriptions" do
-
- # description is auto-generated as "should equal(5)" based on the last #should
- it do
- 3.should equal(2)
- 5.should equal(5)
- end
-
- it { 3.should be > 5 }
-
- it { ["a"].should include("b") }
-
- it { [1,2,3].should_not respond_to(:size) }
-
- end
- """
-
- When I run "<Command> failing_implicit_docstrings_example.rb -fs"
-
- Then the stdout should match /should equal 2/
- And the stdout should match /should be > 5/
- And the stdout should match /should include "b"/
- And the stdout should match /should not respond to #size/
View
65 features-pending/expectations/expect_change.feature
@@ -1,65 +0,0 @@
-Feature: expect change
-
- Expect some code (wrapped in a proc) to change the state of some object.
-
- Scenario: expecting change
- Given a file named "expect_change.rb" with:
- """
- class Counter
- class << self
- def increment
- @count ||= 0
- @count += 1
- end
-
- def count
- @count ||= 0
- end
- end
- end
-
- describe Counter, "#increment" do
- it "should increment the count" do
- expect{Counter.increment}.to change{Counter.count}.from(0).to(1)
- end
-
- # deliberate failure
- it "should increment the count by 2" do
- expect{Counter.increment}.to change{Counter.count}.by(2)
- end
- end
- """
- When I run "spec expect_change.rb"
- Then the stdout should match "2 examples, 1 failure"
- Then the stdout should match "should have been changed by 2, but was changed by 1"
-
- Scenario: expecting no change
- Given a file named "expect_no_change.rb" with:
- """
- class Counter
- class << self
- def increment
- @count ||= 0
- @count += 1
- end
-
- def count
- @count ||= 0
- end
- end
- end
-
- describe Counter, "#increment" do
- it "should not increment the count by 2" do
- expect{Counter.increment}.to_not change{Counter.count}.from(0).to(2)
- end
-
- # deliberate failure
- it "should not increment the count by 1" do
- expect{Counter.increment}.to_not change{Counter.count}.by(1)
- end
- end
- """
- When I run "spec expect_no_change.rb"
- Then the stdout should match "2 examples, 1 failure"
- Then the stdout should match "should not have changed, but did change from 1 to 2"

0 comments on commit de2d010

Please sign in to comment.