Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop integration tests for all routes based on provided sitemap list #1846 #1916

Merged
merged 2 commits into from
Jan 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions test/integration/routes_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
require 'test_helper'

class RoutesTest < ActionDispatch::IntegrationTest

def setup
activate_authlogic
end

test "test signup route" do
assert_routing({ path: '/signup', method: :get }, { controller: 'users', action: 'new' })
end

test "test user create route" do
assert_routing({ path: '/register', method: :post }, { controller: 'users', action: 'create' })
end

test "test people list route" do
assert_routing({ path: '/people', method: :get }, { controller: 'users', action: 'list' })
end

test "test profile page route" do
assert_routing({ path: '/profile/jeff', method: :get }, { controller: 'users', action: 'profile' , id: 'jeff' })
end

test "edit profile route when user logged out redirects to profile page" do
assert_routing({ path: '/profile/jeff/edit', method: :get }, { controller: 'users', action: 'edit' , id: 'jeff' })
get '/profile/jeff/edit'
assert_response 302 #error code 302 is for REDIRECT : https://stackoverflow.com/questions/23788331/http-error-code-302-when-calling-https-webservice
follow_redirect!
assert_equal '/profile/jeff' , path
end

test "edit profile route when user logged in " do
UserSession.create(users(:jeff))
assert_routing({ path: '/profile/jeff/edit', method: :get }, { controller: 'users', action: 'edit' , id: 'jeff' })
get '/profile/jeff/edit'
assert_equal '/profile/jeff/edit' , path
end

end