从我的第一次使用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:inGiven an opening exists called "jobid", objective: "Work here", bob: "My experience", skills: "My skills"
我看过了技能:它看起来像其他人,所以我的经验不足,并希望有人指出我不理解,山姆
你确定你的表格中有一个技能专栏吗? – socjopata 2012-01-05 14:58:09
是的,我甚至在开发数据库中检查了拼写。 thx检查。 – sam452 2012-01-05 18:13:43
是的,但是你必须在测试数据库中有这个列。 – socjopata 2012-01-09 09:10:17