Sha256: 0f81b1e302592ecf4bf24e99a9f80a359a60fbac064d3057b2e9a1bc7d8cfafa
Contents?: true
Size: 1.45 KB
Versions: 3
Compression:
Stored size: 1.45 KB
Contents
require "acceptance_test_helper" class PostsTest < AcceptanceTest 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.2.1 | test/acceptance/posts_test.rb |
funky_form-0.2.0 | test/acceptance/posts_test.rb |
funky_form-0.1.3 | test/acceptance/posts_test.rb |