Starting out a tiny app with my first time using Cucumber 1.1.4 and it’s erroring out with an “unknown attribute” error, it appears. I’d like to ensure a record exists, or created if not. I’ve made sure the show page exists with the erb calls and the record exists, just to be sure.
Here’s my feature:
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”
Here’s my step file:
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
Here’s my error:
# 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"
I’ve looked over the skills: and it looks like the others, so my inexperience is in the way and would appreciate someone pointing out what I’m not understanding, sam
Hmm, you may need to update your test environment database. Run
It should work.
HTH.