Ruby Capybara在黄瓜中有超过1个场景的特征是未定义的方法`go_to_my_own_profile_page'为nil:NilClass(NoMethodError)

时间:2015-01-16 09:14:38

标签: ruby cucumber capybara

我有一个黄瓜功能,我想在多个场景中分割它 当我用

运行测试失败时

undefined method `go_to_my_own_profile_page' for nil:NilClass (NoMethodError) ./features/step_definitions/register_actions_steps.rb:51:in `/^I click on user profile icon
$/' features/com.company/1register.feature:22:in `Given I click on user profile icon
'

如果我在一个功能中只保留一个场景就可以了。

我的功能文件只有一个场景:

use capybara 
Capybara::DSL

@register
Feature: Register with email

Scenario: Test1
Given I click on user profile icon
     

作为项目结构,我尝试保留对象模式。

我的Gemfile:

source "http://rubygems.org"
gem "cucumber"
gem "capybara", "1.1.4", :group => :test
gem "selenium-webdriver"
gem 'capybara-screenshot', :group => :test
gem 'rspec-rails'
gem 'minitest', '< 5'
gem 'capybara_minitest_spec'
gem 'capybara-webkit'

黄瓜配置:

# config/cucumber.yml
##YAML Template
---
default:  --profile bvt --tags @register,register1,@account_settings,@link_fb_to_sl,@link_tw_to_sl
html_report: --format progress --format html --out=./results/html_reports/features_report.html
bvt: --tags @register,@account_settings,@link_fb_to_sl,@link_tw_to_sl
register: --tags @register
account: --tags @account_settings
twitter: --tags @register_twitter
lobbing: --tags @lobbing
facebook: --tags @link_fb_to_sl

0 个答案:

没有答案