2012-01-04 89 views
0

從我的第一次使用Cucumber 1.1.4開始創建一個小應用程序,它出現一個「未知屬性」錯誤,它就會出現。我想確保存在記錄,或者如果不存在,則創建記錄。我確定演示頁面存在erb調用和記錄存在,只是爲了確保。Rails 3,黃瓜「未知屬性」

這是我的特點:

Scenario: normal Given an opening exists called "jobid", objective: "Work here", grizzard: "My experience", skills: "My skills" When I go to the path "/openings/jobname" Then I should see "Sam Walton" Then I should see "Work here" Then I should see "My experience" Then I should see "My skills"

這是我的步文件:

Given /^an opening exists called "([^"]*)", objective: "([^"]*)", bob: "([^"]*)", skills: "([^"]*)"$/ do 
    |opening_name, objective_text, bob_text, skills_text| 

    Opening.create!(name: opening_name, objective: objective_text, skills: skills_text, grizzard: bob_text) 
end 

When /^I go to the path "([^"]*)"$/ do |path| 
    visit(path) 
end 

Then /^I should see "([^"]*)"$/ do |text| 
    page.should have_content(text) 
end 

這裏是我的錯誤:

# features/visitor_can_view_an_opening.feature:6
Given an opening exists called "jobid", objective: "Work here", grizzard: "My experience", skills: "My skills" #
features/step_definitions/general_steps.rb:5
unknown attribute: skills (ActiveRecord::UnknownAttributeError)
./features/step_definitions/general_steps.rb:6:in /^an opening exists called "([^"]*)", objective: "([^"]*)", bob: "([^"]*)", skills: "([^"]*)"$/
features/visitor_can_view_an_opening.feature:7:in Given an opening exists called "jobid", objective: "Work here", bob: "My experience", skills: "My skills"

我看過了技能:它看起來像其他人,所以我的經驗不足,並希望有人指出我不理解,山姆

+0

你確定你的表格中有一個技能專欄嗎? – socjopata 2012-01-05 14:58:09

+0

是的,我甚至在開發數據庫中檢查了拼寫。 thx檢查。 – sam452 2012-01-05 18:13:43

+0

是的,但是你必須在測試數據庫中有這個列。 – socjopata 2012-01-09 09:10:17

回答

2

嗯,你可能需要更新你的測試環境數據庫。運行

 
rake db:test:prepare 

它應該工作。

HTH。