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,30 @@
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
And the stdout should match "ATest"
And the stdout should match "Test::Unit::AssertionFailedError in 'An Example should fail with assert'"
And the stdout should match "'An Example should fail with should' FAILED"
And the stdout should match "10 examples, 6 failures"
And the stdout should match /expected: 40,\s*got: 4/m
And 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
Ands the stdout should match "ATest"
And the stdout should match "Test::Unit::AssertionFailedError in 'An Example should fail with assert'"
And the stdout should match "'An Example should fail with should' FAILED"
And the stdout should match "10 examples, 6 failures"
And the stdout should match /expected: 40,\s*got: 4/m
And the stdout should match /expected: 50,\s*got: 5/m

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

View file

@ -0,0 +1,17 @@
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 PENDING the exit code should be 256
And 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
And the stdout should match "5 examples, 3 failures"