views:

53

answers:

1

When I execute the following cucumber script:

Feature: Manage Customers
  In order to store customers
  As a user
  I want to create and manage customers

    Scenario Outline: Create Customer
      Given I am on new customer screen
      When I fill in Name with "Test Company"
      And I press "Create"
      Then I should see "Customer created successfully"

I get the following message:

When /^I fill in Name with "([^"]*)"$/ do |arg1|
  pending # express the regexp above with the code you wish you had
end

However, I am using webrat and it doesn't appear to be recognizing this line in web_steps.rb:

When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
  fill_in(field, :with => value)
end

I checked my features/support/env.rb and webrat appears to be required properly:

require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
require 'cucumber/rails/world'
require 'cucumber/rails/active_record'
require 'cucumber/web/tableish'

require 'webrat'
require 'webrat/core/matchers'

Webrat.configure do |config|
  config.mode = :rails
  config.open_error_files = false # Set to true if you want error pages to pop up in the browser
end

Any thoughts?

+2  A: 

The step in web_steps.rb expects a quoted value after fill in, i.e. you have to change:

When I fill in Name with "Test Company"

to

When I fill in "Name" with "Test Company"

and it should be recognized.

dhofstet
That was it! I didn't realize you had to use quotes. Thanks!
Rob