Skip to content

Instantly share code, notes, and snippets.

@Mirv
Created June 5, 2017 01:25
Show Gist options
  • Save Mirv/7aa8a21f5604c2499f07d2df6373c2e8 to your computer and use it in GitHub Desktop.
Save Mirv/7aa8a21f5604c2499f07d2df6373c2e8 to your computer and use it in GitHub Desktop.
Error trying to use an integer in rails mini test
RecipeTest#test_recipe_is_valid:
NoMethodError: undefined method `each' for 3:Fixnum
test/models/recipe_test.rb:9:in `block in <class:RecipeTest>'
test "recipe is valid" do
recipe = Recipe.new(name: "SOMEONE", summary: "Something Else",
description: "Something Else", feeds: '3', prep_time: "90") ## -- This is the error line
assert recipe.valid?, 'recipe is not valid'
end
@Mirv
Copy link
Author

Mirv commented Jun 5, 2017

create_table "recipes", force: :cascade do |t|
    t.string   "name"
    t.text     "summary"
    t.text     "description"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "picture"
    t.integer  "user_id"
    t.integer  "prep_time"
    t.integer  "feeds"
  end```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment