0

当我执行以下黄瓜脚本时:

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"

我收到以下消息:

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

但是,我正在使用 webrat,它似乎没有识别 web_steps.rb 中的这一行:

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

我检查了我的features/support/env.rb并且 webrat 似乎是正确的:

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

有什么想法吗?

4

1 回答 1

2

web_steps.rb 中的步骤需要在 之后引用一个值fill in,即您必须更改:

When I fill in Name with "Test Company"

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

它应该被认可。

于 2010-08-21T15:21:55.857 回答