Skip to content

Commit

Permalink
Change update type
Browse files Browse the repository at this point in the history
Instead of doing something that requires a schema change, we'll
just update a validation which *should* work
  • Loading branch information
Kyle Macey committed Jan 17, 2017
1 parent 2855b1c commit bb7a2e0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/models/book.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
class Book < ApplicationRecord
validates :title, presence: true
# validates :year_published, numericality: { only_integer: true }
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
# t.string "website"
t.string "website"
end

end
14 changes: 13 additions & 1 deletion spec/features/books_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@
inception in 2005, and is used by small development shops and giants like
Google, Red Hat, and IBM, and of course many open source projects.
EOF
# fill_in "Website", with: "https://git-scm.com/book/en/v2"
fill_in "Website", with: "https://git-scm.com/book/en/v2"
fill_in "Year published", with: "2009"
end

click_button "Create"
expect(page).to have_text "Created"
end

# TODO: Replace `skip` with `it`
skip "validates a numeric year" do
visit "/books/new"
within "#as_books-create--form" do
fill_in "Title", with: "Pro Git"
fill_in "Year published", with: "taco"
end

click_button "Create"
expect(page).to have_text "Year published is not a number"
end
end

0 comments on commit bb7a2e0

Please sign in to comment.