Story: autogenerated 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: run passing examples with ruby
  • Given the file ../../examples/pure/autogenerated_docstrings_example.rb
  • When I run it with the ruby interpreter -fs
  • Then the stdout should match /should equal 5/
  • Then the stdout should match /should be < 5/
  • Then the stdout should match /should include "a"/
  • Then the stdout should match /should respond to #size/
Scenario: run failing examples with ruby
  • Given the file ../../failing_examples/failing_autogenerated_docstrings_example.rb
  • When I run it with the ruby interpreter -fs
  • Then the stdout should match /should equal 2/
  • Then the stdout should match /should be > 5/
  • Then the stdout should match /should include "b"/
  • Then the stdout should match /should not respond to #size/
Scenario: run passing examples with spec
  • Given the file ../../examples/pure/autogenerated_docstrings_example.rb
  • When I run it with the spec script -fs
  • Then the stdout should match /should equal 5/
  • Then the stdout should match /should be < 5/
  • Then the stdout should match /should include "a"/
  • Then the stdout should match /should respond to #size/
Scenario: run failing examples with spec
  • Given the file ../../failing_examples/failing_autogenerated_docstrings_example.rb
  • When I run it with the spec script -fs
  • Then the stdout should match /should equal 2/
  • Then the stdout should match /should be > 5/
  • Then the stdout should match /should include "b"/
  • Then the stdout should match /should not respond to #size/
Story: Spec::ExampleGroup with should methods

As an RSpec adopter accustomed to classes and methods
I want to use should_* methods in an ExampleGroup
So that I use RSpec with classes and methods that look more like RSpec examples

Scenario: Run with ruby
  • Given the file spec/example_group_with_should_methods.rb
  • When I run it with the ruby interpreter
  • Then the exit code should be 256
  • Then the stdout should match "2 examples, 1 failure"
Scenario: Run with spec
  • Given the file spec/example_group_with_should_methods.rb
  • When I run it with the spec script
  • Then the exit code should be 256
  • Then the stdout should match "2 examples, 1 failure"
Story: Nested example groups

As an RSpec user
I want to nest examples groups
So that I can better organize my examples

Scenario: Run with ruby
  • Given the file ../../examples/pure/stack_spec_with_nested_example_groups.rb
  • When I run it with the ruby interpreter -fs
  • Then the stdout should match /Stack \(empty\)/
  • Then the stdout should match /Stack \(full\)/
Scenario: Run with ruby
  • Given the file ../../examples/pure/stack_spec_with_nested_example_groups.rb
  • When I run it with the spec script -fs
  • Then the stdout should match /Stack \(empty\)/
  • Then the stdout should match /Stack \(full\)/
Story: Getting correct output

As an RSpec user
I want to see output only once
So that I don't get confused

Scenario: Run with ruby
  • Given the file spec/simple_spec.rb
  • When I run it with the ruby interpreter
  • Then the exit code should be 0
  • Then the stdout should not match /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/m
  • Then the stdout should match "1 example, 0 failures"
Scenario: Run with CommandLine object
  • Given the file spec/simple_spec.rb
  • When I run it with the CommandLine object
  • Then the exit code should be 0
  • Then the stdout should not match "Loaded suite"
  • Then the stdout should not match /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/m
  • Then the stdout should match "1 example, 0 failures"
Scenario: Tweak backtrace
  • Given the file stories/failing_story.rb
  • When I run it with the ruby interpreter
  • Then the stdout should not match /\/lib\/spec\//
Story: Spec and test together

As an RSpec adopter with existing Test::Unit tests
I want to run a few specs alongside my existing Test::Unit tests
So that I can experience a smooth, gradual migration path

Scenario: Run with ruby
  • Given the file test/spec_and_test_together.rb
  • When I run it with the ruby interpreter -fs
  • Then the exit code should be 256
  • Then the stdout should match "ATest"
  • Then the stdout should match "Test::Unit::AssertionFailedError in 'An Example should fail with assert'"
  • Then the stdout should match "'An Example should fail with should' FAILED"
  • Then the stdout should match "10 examples, 6 failures"
  • Then the stdout should match /expected: 40,\s*got: 4/m
  • Then the stdout should match /expected: 50,\s*got: 5/m
Scenario: Run with spec
  • Given the file test/spec_and_test_together.rb
  • When I run it with the spec script -fs
  • Then the exit code should be 256
  • Then the stdout should match "Test::Unit::AssertionFailedError in 'An Example should fail with assert'"
  • Then the stdout should match "'An Example should fail with should' FAILED"
  • Then the stdout should match "10 examples, 6 failures"
  • Then the stdout should match /expected: 40,\s*got: 4/m
  • Then the stdout should match /expected: 50,\s*got: 5/m
Story: Test::Unit::TestCase extended by rspec with should methods

As an RSpec adopter with existing Test::Unit tests
I want to use should_* methods in a Test::Unit::TestCase
So that I use RSpec with classes and methods that look more like RSpec examples

Scenario: Run with ruby
  • Given the file test/test_case_with_should_methods.rb
  • When I run it with the ruby interpreter
  • Then the exit code should be 256
  • Then the stdout should match "5 examples, 3 failures"
Scenario: Run with spec
  • Given the file test/test_case_with_should_methods.rb
  • When I run it with the spec script
  • Then the exit code should be 256
  • Then the stdout should match "5 examples, 3 failures"