开发者

Webrat (web_steps.rb) not being used

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 开发者_Go百科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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜