我正在使用rspec/capybara/devise在应用程序中进行集成测试.应用程序的一个功能是使用确认功能进行不断填充的"帐户注册"(即注册 - 获取确认电子邮件 - 单击链接 - 帐户已经过验证).
require 'spec_helper'
describe "User Authentication" do
describe "New user" do
before(:each) do
@user = Factory.build(:user)
end
it "can confirm account by clicking on confirmation link" do
visit root_path
click_link "Register"
page.should have_content "Register for an account"
fill_in "user_email", :with => @user.email
fill_in "user_password", :with => @user.password
fill_in "user_password_confirmation", :with => @user.password
fill_in "user_first_name", :with => @user.first_name
fill_in "user_last_name", :with => @user.last_name
fill_in "user_city", :with => @user.city
fill_in "user_province", :with => @user.province
fill_in "user_country", …Run Code Online (Sandbox Code Playgroud) 为了使用Cucumber作为命令行脚本,我按照提供的说明安装了aruba gem.它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了
require 'aruba/cucumber'
Run Code Online (Sandbox Code Playgroud)
在'features/env.rb'中
为了确保它的工作,我写了以下场景:
@announce
Scenario: Testing cucumber/aruba
Given a blank slate
Then the output from "ls -la" should contain "drw"
Run Code Online (Sandbox Code Playgroud)
假设事情应该失败.
它确实失败了,但由于错误的原因它失败了:
@announce
Scenario: Testing cucumber/aruba
Given a blank slate
Then the output from "ls -la" should contain "drw"
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[] (NoMethodError)
features/dataloader.feature:9:in `Then the output from "ls -la" should contain "drw"'
Run Code Online (Sandbox Code Playgroud)
任何人都有任何想法为什么这不起作用?这似乎是非常基本的阿鲁巴行为.