Skip to content

Commit

Permalink
Make all specs and features pass on both 1.8.6, 1.8.7 and 1.9.2dev. H…
Browse files Browse the repository at this point in the history
…ad to add dummy statements to make 1.9.2 report Proc linenumbers in the same way as 1.8
  • Loading branch information
aslakhellesoy committed Jan 20, 2010
1 parent 2d3b294 commit f78fb2f
Show file tree
Hide file tree
Showing 58 changed files with 390 additions and 361 deletions.
6 changes: 1 addition & 5 deletions Rakefile
Expand Up @@ -54,11 +54,7 @@ end

Dir['gem_tasks/**/*.rake'].each { |rake| load rake }

if(Cucumber::RUBY_1_9)
task :default => [:check_dependencies, :cucumber] # RSpec doesn't run on 1.9 yet.
else
task :default => [:check_dependencies, :spec, :cucumber]
end
task :default => [:check_dependencies, :spec, :cucumber]

require 'rake/clean'
CLEAN.include %w(**/*.{log,pyc})
44 changes: 22 additions & 22 deletions examples/self_test/features/step_definitions/sample_steps.rb
Expand Up @@ -2,72 +2,72 @@ def flunker
raise "FAIL"
end

Given /^passing$/ do |table|
end
Given(/^passing$/) do |table| end


Given /^failing$/ do |string|
Given /^failing$/ do |string| x=1
flunker
end

Given /^passing without a table$/ do
end
Given(/^passing without a table$/) do end

Given /^failing without a table$/ do

Given /^failing without a table$/ do x=1
flunker
end

Given /^a step definition that calls an undefined step$/ do
Given 'this does not exist'
Given /^a step definition that calls an undefined step$/ do Given 'this does not exist'
end

Given /^call step "(.*)"$/ do |step|

Given /^call step "(.*)"$/ do |step| x=1
Given step
end

Given /^'(.+)' cukes$/ do |cukes|
Given /^'(.+)' cukes$/ do |cukes| x=1
raise "We already have #{@cukes} cukes!" if @cukes
@cukes = cukes
end
Then /^I should have '(.+)' cukes$/ do |cukes|
Then /^I should have '(.+)' cukes$/ do |cukes| x=1
@cukes.should == cukes
end

Given /^'(.+)' global cukes$/ do |cukes|
Given /^'(.+)' global cukes$/ do |cukes| x=1
$scenario_runs ||= 0
flunker if $scenario_runs >= 1
$cukes = cukes
$scenario_runs += 1
end

Then /^I should have '(.+)' global cukes$/ do |cukes|
Then /^I should have '(.+)' global cukes$/ do |cukes| x=1
$cukes.should == cukes
end

Given /^table$/ do |table|
Given /^table$/ do |table| x=1
@table = table
end

Given /^multiline string$/ do |string|
Given /^multiline string$/ do |string| x=1
@multiline = string
end

Then /^the table should be$/ do |table|
Then /^the table should be$/ do |table| x=1
@table.raw.should == table.raw
end

Then /^the multiline string should be$/ do |string|
Then /^the multiline string should be$/ do |string| x=1
@multiline.should == string
end

Given /^failing expectation$/ do
Given /^failing expectation$/ do x=1
'this'.should == 'that'
end

Given /^unused$/ do
end
Given(/^unused$/) do end


Given(/^another unused$/) do end

Given /^another unused$/ do
end

require 'fileutils'

Expand Down
194 changes: 97 additions & 97 deletions features/announce.feature
Expand Up @@ -3,120 +3,120 @@ Feature: Delayed announcement
Background:
Given a standard Cucumber project directory structure
And a file named "features/step_definitions/steps.rb" with:
"""
Given /^I use announce with text "(.*)"$/ do |ann|
"""
Given /^I use announce with text "(.*)"$/ do |ann| x=1
announce(ann)
end
end
Given /^I use multiple announces$/ do
Given /^I use multiple announces$/ do x=1
announce("Multiple")
announce("Announce")
end
end
Given /^I use announcement (.+) in line (.+) (?:with result (.+))$/ do |ann, line, result|
Given /^I use announcement (.+) in line (.+) (?:with result (.+))$/ do |ann, line, result| x=1
announce("Last announcement") if line == "3"
announce("Line: #{line}: #{ann}")
fail if result =~ /fail/i
end
end
Given /^I use announce and step fails$/ do
Given /^I use announce and step fails$/ do x=1
announce("Announce with fail")
fail
end
end
Given /^this step works$/ do
end
"""
Given /^this step works$/ do x=1
end
"""
And a file named "features/f.feature" with:
"""
Scenario: S
Given I use announce with text "Ann"
And this step works
Scenario: S2
Given I use multiple announces
And this step works
Scenario Outline: S3
Given I use announcement <ann> in line <line>
Examples:
| line | ann |
| 1 | anno1 |
| 2 | anno2 |
| 3 | anno3 |
Scenario: S4
Given I use announce and step fails
And this step works
Scenario Outline: s5
Given I use announcement <ann> in line <line> with result <result>
Examples:
| line | ann | result |
| 1 | anno1 | fail |
| 2 | anno2 | pass |
"""
Scenario: S
Given I use announce with text "Ann"
And this step works
Scenario: S2
Given I use multiple announces
And this step works
Scenario Outline: S3
Given I use announcement <ann> in line <line>
Examples:
| line | ann |
| 1 | anno1 |
| 2 | anno2 |
| 3 | anno3 |
Scenario: S4
Given I use announce and step fails
And this step works
Scenario Outline: s5
Given I use announcement <ann> in line <line> with result <result>
Examples:
| line | ann | result |
| 1 | anno1 | fail |
| 2 | anno2 | pass |
"""

Scenario: Delayed announcements feature
When I run cucumber --format pretty features/f.feature
Then the output should contain
"""
Scenario: S # features/f.feature:1
Given I use announce with text "Ann" # features/step_definitions/steps.rb:1
Ann
And this step works # features/step_definitions/steps.rb:21
Scenario: S2 # features/f.feature:5
Given I use multiple announces # features/step_definitions/steps.rb:5
Multiple
Announce
And this step works # features/step_definitions/steps.rb:21
Scenario Outline: S3 # features/f.feature:9
Given I use announcement <ann> in line <line> # features/f.feature:10
Examples:
| line | ann |
| 1 | anno1 |
| 2 | anno2 |
| 3 | anno3 |
Scenario: S4 # features/f.feature:18
Given I use announce and step fails # features/step_definitions/steps.rb:16
Announce with fail
(RuntimeError)
./features/step_definitions/steps.rb:18:in `/^I use announce and step fails$/'
features/f.feature:19:in `Given I use announce and step fails'
And this step works # features/step_definitions/steps.rb:21
Scenario Outline: s5 # features/f.feature:22
Given I use announcement <ann> in line <line> with result <result> # features/step_definitions/steps.rb:10
Examples:
| line | ann | result |
| 1 | anno1 | fail | Line: 1: anno1
(RuntimeError)
./features/step_definitions/steps.rb:13:in `/^I use announcement (.+) in line (.+) (?:with result (.+))$/'
features/f.feature:23:in `Given I use announcement <ann> in line <line> with result <result>'
| 2 | anno2 | pass | Line: 2: anno2
"""
When I run cucumber --format pretty features/f.feature
Then the output should contain
"""
Scenario: S # features/f.feature:1
Given I use announce with text "Ann" # features/step_definitions/steps.rb:1
Ann
And this step works # features/step_definitions/steps.rb:21
Scenario: S2 # features/f.feature:5
Given I use multiple announces # features/step_definitions/steps.rb:5
Multiple
Announce
And this step works # features/step_definitions/steps.rb:21
Scenario Outline: S3 # features/f.feature:9
Given I use announcement <ann> in line <line> # features/f.feature:10
Examples:
| line | ann |
| 1 | anno1 |
| 2 | anno2 |
| 3 | anno3 |
Scenario: S4 # features/f.feature:18
Given I use announce and step fails # features/step_definitions/steps.rb:16
Announce with fail
(RuntimeError)
./features/step_definitions/steps.rb:18:in `/^I use announce and step fails$/'
features/f.feature:19:in `Given I use announce and step fails'
And this step works # features/step_definitions/steps.rb:21
Scenario Outline: s5 # features/f.feature:22
Given I use announcement <ann> in line <line> with result <result> # features/step_definitions/steps.rb:10
Examples:
| line | ann | result |
| 1 | anno1 | fail | Line: 1: anno1
(RuntimeError)
./features/step_definitions/steps.rb:13:in `/^I use announcement (.+) in line (.+) (?:with result (.+))$/'
features/f.feature:23:in `Given I use announcement <ann> in line <line> with result <result>'
| 2 | anno2 | pass | Line: 2: anno2
"""

Scenario: Non-delayed announcements feature (progress formatter)
When I run cucumber --format progress features/f.feature
Then the output should contain
"""
Ann
..
Multiple
Announce
..-UUUUUU
Announce with fail
F--
Line: 1: anno1
FFF
Line: 2: anno2
...
"""
"""
Ann
..
Multiple
Announce
..-UUUUUU
Announce with fail
F--
Line: 1: anno1
FFF
Line: 2: anno2
...
"""
5 changes: 1 addition & 4 deletions features/background.feature
Expand Up @@ -281,10 +281,7 @@ Feature: backgrounds
$after = true
end
Given /^whatever$/ do
$before.should == true
$step = true
end
Given(/^whatever$/) { $before.should == true; $step = true }
at_exit do
$before.should == true
Expand Down
3 changes: 1 addition & 2 deletions features/bug_475.feature
Expand Up @@ -16,8 +16,7 @@ Feature: https://rspec.lighthouseapp.com/projects/16211/tickets/475
"""
And a file named "features/step_definitions/steps.rb" with:
"""
Given /a multiline string:/ do |s|
s.should =~ /hello (\w+)/
Given /a multiline string:/ do |s| s.should =~ /hello (\w+)/
end
"""
When I run cucumber features/f.feature
Expand Down
8 changes: 4 additions & 4 deletions features/call_many_steps.feature
Expand Up @@ -24,15 +24,15 @@ Feature: http://gist.github.com/221223
"""
And a file named "features/step_definitions/steps.rb" with:
"""
Given /^a multiline string:$/ do |s|
Given /^a multiline string:$/ do |s| x=1
raise "I got multiline:\n#{s}"
end
Given /^a table:$/ do |t|
Given /^a table:$/ do |t| x=1
raise "I got table:\n#{t.raw.inspect}"
end
Given /^I call a multiline string with (.*)$/ do |s|
Given /^I call a multiline string with (.*)$/ do |s| x=1
steps %Q{
Given a multiline string:
\"\"\"
Expand All @@ -42,7 +42,7 @@ Feature: http://gist.github.com/221223
}
end
Given /^I call a table with (.*)$/ do |s|
Given /^I call a table with (.*)$/ do |s| x=1
steps %Q{
Given a table:
|a|b|
Expand Down
5 changes: 2 additions & 3 deletions features/exception_in_after_block.feature
Expand Up @@ -7,12 +7,11 @@ Feature: Exception in After Block
Given a standard Cucumber project directory structure
And a file named "features/step_definitions/steps.rb" with:
"""
Given /^this step does something naughty$/ do
Given /^this step does something naughty$/ do x=1
@naughty = true
end
Given /^this step works$/ do
end
Given(/^this step works$/) do; end
"""
And a file named "features/support/env.rb" with:
"""
Expand Down

0 comments on commit f78fb2f

Please sign in to comment.