Last active
May 16, 2019 00:31
-
-
Save elliotlarson/f356987bf7ee046cb4fa3208630f4a63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class FoosControllerTest < ActionDispatch::IntegrationTest | |
setup do | |
@foo = foos(:one) | |
end | |
test "should get index" do | |
get foos_url | |
assert_response :success | |
end | |
test "should get new" do | |
get new_foo_url | |
assert_response :success | |
end | |
test "should create foo" do | |
assert_difference('Foo.count') do | |
post foos_url, params: { foo: { bar: @foo.bar, baz: @foo.baz } } | |
end | |
assert_redirected_to foo_url(Foo.last) | |
end | |
test "should show foo" do | |
get foo_url(@foo) | |
assert_response :success | |
end | |
test "should get edit" do | |
get edit_foo_url(@foo) | |
assert_response :success | |
end | |
test "should update foo" do | |
patch foo_url(@foo), params: { foo: { bar: @foo.bar, baz: @foo.baz } } | |
assert_redirected_to foo_url(@foo) | |
end | |
test "should destroy foo" do | |
assert_difference('Foo.count', -1) do | |
delete foo_url(@foo) | |
end | |
assert_redirected_to foos_url | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "application_system_test_case" | |
class FoosTest < ApplicationSystemTestCase | |
setup do | |
@foo = foos(:one) | |
end | |
test "visiting the index" do | |
visit foos_url | |
assert_selector "h1", text: "Foos" | |
end | |
test "creating a Foo" do | |
visit foos_url | |
click_on "New Foo" | |
fill_in "Bar", with: @foo.bar | |
fill_in "Baz", with: @foo.baz | |
click_on "Create Foo" | |
assert_text "Foo was successfully created" | |
click_on "Back" | |
end | |
test "updating a Foo" do | |
visit foos_url | |
click_on "Edit", match: :first | |
fill_in "Bar", with: @foo.bar | |
fill_in "Baz", with: @foo.baz | |
click_on "Update Foo" | |
assert_text "Foo was successfully updated" | |
click_on "Back" | |
end | |
test "destroying a Foo" do | |
visit foos_url | |
page.accept_confirm do | |
click_on "Destroy", match: :first | |
end | |
assert_text "Foo was successfully destroyed" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment