2011-02-04 6 views
0

다음 문제에 도움을 주시면 감사하겠습니다.정의되지 않은 메소드`has_selector? ' nilClass (NoMethodError) 오이 (카피 바라) 단계

나는 다음과 같은 오류 얻을

rake cucumber:wip 

사용하여 내 오이 (사용 카피 바라) 기능을 실행하면 (즉, 응답 객체가 어떤 이유로 정의되지 않은이)

Then I should be able to see 1 announcement # features/step_definitions/view_announcements_steps.rb:8 
     undefined method `has_selector?' for nil:NilClass (NoMethodError) 
     ./features/step_definitions/view_announcements_steps.rb:10:in `/^I should be able to see (\d+) announcement$/' 
     features/view_announcements.feature:13:in `Then I should be able to see 1 announcement' 

나는이를 오이 특징 파일 다음 :

@wip 
    Feature: User views announcements 
    As a user 
    I want to be able to view announcements 
    So that I am up-to-date with the latest news 

Background: 
    Given there is 1 announcement 

Scenario: I am not logged in 
    Given I am not logged in 
    When I go to main 
    Then I should be able to see 1 announcement 

Scenario: I am logged in 
    Given I am logged in as "test/password" 
    When I go to main 
    Then I should be able to see 1 announcement 

및 단계 정의 :

Given /^there is|are (\d+) announcement$/ do |arg1| 
    arg1.to_i.times do 
     Announcement.create!({:title => "Test Announcement", 
                 :body => "This is a test"}) 
    end 
end 

Then /^I should be able to see (\d+) announcement$/ do |arg1| 
    response.should have_selector("div#announcement", :count => arg1) 
end 

When /^(?:|I)go to (.+)$/ do |page_name| 
    visit path_to(page_name) 
end 

Given /^I am not logged in$/ do 
    visit('/users/sign_out') 
end 

Given /^user "([^\/]*)\/([^\"]*)" exists$/ do |username, password| 
    User.new(:username => username, 
      :password => password, 
      :password_confirmation => password).save! 
end 

Given /^I am logged in as "([^\/]*)([^\"]*)"$/ do |username, password| 
    Given %{user "#{username}/#{password}" exists} 
    visit('/users/sign_in')#And %{I go to sign_in} 
    And %{I fill in "user_password" with "#{password}"} 
    And %{I press "Sign in"} 
end 

답변

0

features/support/paths.rb에서 경로가 올바르지 않은 것으로 나타났습니다.

관련 문제