2012-01-04 88 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。