Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
The test case of executing two rspec behaviours with line numbers
describe "Add" do # sample test rspec 1
it "can add single digit" do
puts "Add 1 + 2"
(1+2).should == 3
end
it "can add double digit" do
puts "Add 11 + 22"
(11+22).should == 33
end
end
require 'rubygems'
require 'rspec'
err, out = StringIO.new, StringIO.new
args = ["add_spec.rb", "--line_number", "4"]
RSpec::Core::Runner.run(args, err, out)
RSpec.reset
args = ["minus_spec.rb", "--line_number", "10"]
RSpec::Core::Runner.run(args, err, out)
out.rewind; puts out.read
describe "Minu" do
# No tests on line 4
it "can minus single digit" do
puts "3 - 2"
(3-2).should == 1
end
it "can minus double digit" do
puts "22 - 11"
(22-11).should == 11
end
end
@zhimin
Owner

Download three files in the same folder, then run drive_rspec_runner.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.