Topic: The Cucumber book test 1
i am doing this tutorial on the "The Cucumber book" and my test is failing
features/step_definitions/calculator_steps.rb
Given /^the input "([^"]*)"$/ do |input|
@input = input
end
When /^the calculator is run$/ do
@output = `ruby calc.rb #{@input}`
raise('Command failed!') unless $?.success?
end
Then /^the output should be "([^"]*)"$/ do |expected_output|
@output.should == expected_output
endfeatures/adding.feature
Feature: Adding
Scenario: Add two numbers
Given the input "2+2"
When the calculator is run
Then the output should be "4"calc.rb
print "4"TEST OUTPUT
cucumber
Feature: Adding
Scenario: Add two numbers # features/adding.feature:3
Given the input "2+2" # features/step_definitions/calculator_steps.rb:9
When the calculator is run # features/step_definitions/calculator_steps.rb:13
Then the output should be "4" # features/step_definitions/calculator_steps.rb:18
undefined method `should' for "4":String (NoMethodError)
./features/step_definitions/calculator_steps.rb:19:in `/^the output should be "([^"]*)"$/'
features/adding.feature:6:in `Then the output should be "4"'
Failing Scenarios:
cucumber features/adding.feature:3 # Scenario: Add two numbers
1 scenario (1 failed)
3 steps (1 failed, 2 passed)
0m0.019s