work on tests

This commit is contained in:
Josh
2018-05-10 15:03:59 -04:00
parent 5347d902c0
commit b452932767
12 changed files with 165 additions and 127 deletions

View File

@@ -1,7 +1,35 @@
require 'test_helper'
class RoomsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
def setup
@steve = users(:steve)
@mark = users(:mark)
@kitchen = rooms(:kitchen)
@garage = rooms(:garage)
@steve.room = @kitchen
@mark.room = @garage
end
test 'should redirect to root if not logged in.' do
get room_path(@kitchen.uid)
assert_redirected_to root_path
end
test 'should redirect to correct room if incorrect room.' do
post create_session_path, params: {session: {email: @mark.email, password: "mark12345"}}
get room_path(@kitchen.uid)
assert_redirected_to room_path(@garage.uid)
end
test 'should render room if user is owner.' do
post create_session_path, params: {session: {email: @steve.email, password: "steve12345"}}
get room_path(@kitchen.uid)
assert_response :success
end
end