gpt4 book ai didi

ruby-on-rails - Webrat (web_steps.rb) 未被使用

转载 作者:行者123 更新时间:2023-11-28 21:14:55 29 4
gpt4 key购买 nike

当我执行以下 cucumber 脚本时:

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

有什么想法吗?

最佳答案

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

When I fill in Name with "Test Company"

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

它应该被识别。

关于ruby-on-rails - Webrat (web_steps.rb) 未被使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3537846/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com