Skip to content

Instantly share code, notes, and snippets.

@paulspencerwilliams
Created August 3, 2013 15:48
Show Gist options
  • Save paulspencerwilliams/6146918 to your computer and use it in GitHub Desktop.
Save paulspencerwilliams/6146918 to your computer and use it in GitHub Desktop.
How to map user readable uppercase 'Attributes' for models in tabular Given steps with lowercase rails model attributes
Background:
Given the following set of activites exist
| Activity | Weather |
| Got to the Weston Super Mare | Sunny |
| Visit Sea Life Center | Raining |
| Visit West Midlands Safari Park | Sunny |
| Visit Madame Tussauds | Raining |
Scenario: Suggesting a set of sunny activities
When I state that Saturday's weather will be "Sunny"
Then I will be presented with a list of sunny activities
Given(/^the following set of activites exist$/) do |table|
table.hashes.each do |attributes|
FactoryGirl.create(:thing, attributes)
end
end
Gives error:
Given the following set of activites exist # features/step_definitions/steps.rb:1
| Activity | Weather |
| Got to the Weston Super Mare | Sunny |
| Visit Sea Life Center | Raining |
| Visit West Midlands Safari Park | Sunny |
| Visit Madame Tussauds | Raining |
undefined method `Activity=' for #<Thing:0x007fe177271810> (NoMethodError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment