Webrat (web_steps.rb) не используется - PullRequest
0 голосов
/ 21 августа 2010

Когда я выполняю следующий скрипт огурца:

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

Любоймысли?

1 Ответ

2 голосов
/ 21 августа 2010

В шаге web_steps.rb ожидается значение в кавычках после fill in, т. Е. Вы должны изменить:

When I fill in Name with "Test Company"

на

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

, и его следует распознать.1008 *

...