added RSpec and RSpec on Rails

This commit is contained in:
Xin Zheng 2008-01-22 16:39:09 +00:00
parent ddd5b4cf19
commit 3f607d565b
316 changed files with 23828 additions and 0 deletions

View file

@ -0,0 +1,45 @@
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/
And the stdout should match /should be < 5/
And the stdout should match /should include "a"/
And 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/
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/
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/
And the stdout should match /should be < 5/
And the stdout should match /should include "a"/
And 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/
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 file

@ -0,0 +1,17 @@
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
And 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
And the stdout should match "2 examples, 1 failure"

View file

@ -0,0 +1,17 @@
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\)/
And 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\)/
And the stdout should match /Stack \(full\)/

View file

@ -0,0 +1,25 @@
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
And the stdout should not match /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/m
And 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
And the stdout should not match "Loaded suite"
And the stdout should not match /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/m
And 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\//

View file

@ -0,0 +1,7 @@
require File.join(File.dirname(__FILE__), *%w[.. helper])
with_steps_for :running_rspec do
Dir["#{File.dirname(__FILE__)}/*"].each do |file|
run file if File.file?(file) && !(file =~ /\.rb$/)
end
end