Sha256: 12b33ba6b5e9f0122311bf8faf1732518f7c59b387c825e7e2a6b8d0c2900dc4
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
require_relative "../integration_test_helper" class PostsTest < ActiveSupport::IntegrationCase def test_creating_a_post visit new_post_path within "#new_post" do fill_in "Title", :with => "Fruits" fill_in "Body", :with => "Apples and oranges" click_button "Create" end assert page.has_content?("Successfully created") end def test_creating_a_post_when_validation_errors visit new_post_path within "#new_post" do fill_in "Title", :with => "a" * 40 fill_in "Body", :with => "Short" click_button "Create" end assert page.has_content?("Validation errors") end def test_editing_existing_post_title post = Post.create(:title => "Fruits", :body => "Apples and oranges") visit edit_post_path(post) within "#edit_post_#{post.id}" do assert "Fruits", page.find("#post_title").value fill_in "Title", :with => "My Fruits" click_button "Update" end assert page.has_content?("Successfully updated") end def test_editing_existing_post_title_when_validation_errors post = Post.create(:title => "Fruits", :body => "Apples and oranges") visit edit_post_path(post) invalid_title = "a" * 40 within "#edit_post_#{post.id}" do assert "Fruits", page.find("#post_title").value fill_in "Title", :with => invalid_title click_button "Update" end assert page.has_content?("Validation errors") assert invalid_title, page.find("#post_title").value end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
funky_form-0.1.2 | test/integration/posts_test.rb |
funky_form-0.1.1 | test/integration/posts_test.rb |
funky_form-0.1.0 | test/integration/posts_test.rb |