working form
This commit is contained in:
48
test/controllers/proverbs_controller_test.rb
Normal file
48
test/controllers/proverbs_controller_test.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ProverbsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@proverb = proverbs(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get proverbs_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_proverb_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create proverb" do
|
||||
assert_difference('Proverb.count') do
|
||||
post proverbs_url, params: { proverb: { author_id: @proverb.author_id, quote: @proverb.quote, user_id: @proverb.user_id } }
|
||||
end
|
||||
|
||||
assert_redirected_to proverb_url(Proverb.last)
|
||||
end
|
||||
|
||||
test "should show proverb" do
|
||||
get proverb_url(@proverb)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_proverb_url(@proverb)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update proverb" do
|
||||
patch proverb_url(@proverb), params: { proverb: { author_id: @proverb.author_id, quote: @proverb.quote, user_id: @proverb.user_id } }
|
||||
assert_redirected_to proverb_url(@proverb)
|
||||
end
|
||||
|
||||
test "should destroy proverb" do
|
||||
assert_difference('Proverb.count', -1) do
|
||||
delete proverb_url(@proverb)
|
||||
end
|
||||
|
||||
assert_redirected_to proverbs_url
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user