首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Webrat (web_steps.rb)未被使用

Webrat (web_steps.rb)未被使用
EN

Stack Overflow用户
提问于 2010-08-21 13:53:01
回答 1查看 428关注 0票数 0

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

代码语言:javascript
复制
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"

我收到以下信息:

代码语言:javascript
复制
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中,它似乎没有识别这一行:

代码语言:javascript
复制
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
  fill_in(field, :with => value)
end

我检查了我的features/support/env.rb和webrat似乎是正确的要求:

代码语言:javascript
复制
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

有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-08-21 15:21:55

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

代码语言:javascript
复制
When I fill in Name with "Test Company"

代码语言:javascript
复制
When I fill in "Name" with "Test Company"

而且应该得到认可。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3537846

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档