15 Jan 2013, 15:49
Generic-user-small

Alistair Young (5 posts)

When I copy/paste the step definitions they don’t seem to work. The formatting is off in the editor due to the odd number of quotes which seems to cause it to ignore the 3rd definition

Feature: Adding

Scenario: Add two numbers # features/metadata/test.feature:2 Given the input “2+2” # features/metadata/step_definitions/metadata_steps.rb:1 TODO (Cucumber::Pending) ./features/metadata/step_definitions/metadata_steps.rb:2:in /^the input "([^"]*)"$/' features/metadata/test.feature:3:in Given the input “2+2”’ When the calculator is run Then the output should be “4” # features/metadata/test.feature:4

1 scenario (1 pending) 2 steps (1 undefined, 1 pending) 0m0.001s

You can implement step definitions for undefined steps with these snippets:

When /^the calculator is run Then the output should be “(.*?)”$/ do |arg1| pending # express the regexp above with the code you wish you had end

15 Jan 2013, 15:50
Generic-user-small

Alistair Young (5 posts)

The book has:

Given /^the input “([^”]*)”$/ do |arg1| pending # express the regexp above with the code you wish you had end

When /^the calculator is run$/ do pending # express the regexp above with the code you wish you had end

Then /^the output should be “([^”]*)”$/ do |arg1| pending # express the regexp above with the code you wish you had end

15 Jan 2013, 16:08
Generic-user-small

Alistair Young (5 posts)

then again I could just copy/paste correctly! Missed out the Then in the feature. Seems to be ok now

16 Jan 2013, 10:04
Avatar_pragsmall

Matt Wynne (86 posts)

Good :)

  You must be logged in to comment