-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completed Integration tests for 'users' and 'home' controller (#74)
* Addes some tests for users profile * Adding tp correct branch * Added 2 tests to users. TODO: password change * corrected tests * Skipping password change tests as this is handled by devise. * fix for #66 as suggested by @anantshri * changed padding unit to em * Added notes for Docker Desktop on Windows * Create users_password integration test * Completed integration tests for home page Co-authored-by: Abhisek Datta <[email protected]>
- Loading branch information
Showing
5 changed files
with
124 additions
and
46 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html | ||
|
||
one: {} | ||
one: | ||
id: 1 | ||
name: "page-1" | ||
description: 'Test page 1' | ||
navigation_name: 'page1' | ||
content: "This is test page 1" | ||
published: true | ||
|
||
|
||
two: {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
require 'test_helper' | ||
|
||
class HomeTest < ActionDispatch::IntegrationTest | ||
include Devise::Test::IntegrationHelpers | ||
|
||
setup do | ||
ENV["SWACHALIT_DISABLE_BACKGROUND_TASKS"] = "1" | ||
sign_in users(:one) | ||
end | ||
|
||
teardown do | ||
ENV["SWACHALIT_DISABLE_BACKGROUND_TASKS"] = nil | ||
end | ||
|
||
test "User visits home page" do | ||
get root_path | ||
assert_response :ok | ||
end | ||
|
||
test "User visits upcoming event page" do | ||
get upcoming_path | ||
assert_response :ok | ||
end | ||
|
||
test "User visits archives page" do | ||
get archives_path | ||
assert_response :ok | ||
end | ||
|
||
test "User visits about page" do | ||
get about_path | ||
assert_response :ok | ||
end | ||
|
||
test "User visits calendar page" do | ||
get calendar_path | ||
assert_response :ok | ||
end | ||
|
||
test "User visits privacy page" do | ||
get privacy_path | ||
assert_response :ok | ||
end | ||
|
||
test "User visits public profile page of existing user" do | ||
get public_profile_path(1) | ||
assert_response :ok | ||
end | ||
|
||
test "User visits public profile page of non-existent user" do | ||
assert_raise (ActiveRecord::RecordNotFound) { get public_profile_path(9999) } | ||
end | ||
|
||
test "User visits raise excepton page" do | ||
assert_raise { get raise_exception_test_path } | ||
end | ||
|
||
test "User visits sessions page" do | ||
get event_sessions_path | ||
assert_response :ok | ||
end | ||
|
||
test "User visits forum page" do | ||
get forum_path | ||
assert_response :ok | ||
end | ||
|
||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require 'test_helper' | ||
|
||
class UsersPasswordTest < ActionDispatch::IntegrationTest | ||
include Devise::Test::IntegrationHelpers | ||
|
||
setup do | ||
ENV["SWACHALIT_DISABLE_BACKGROUND_TASKS"] = "1" | ||
end | ||
|
||
teardown do | ||
ENV["SWACHALIT_DISABLE_BACKGROUND_TASKS"] = nil | ||
end | ||
|
||
test "Unauthenticated user can access passsword recovery page" do | ||
get new_user_password_path | ||
assert_response :ok | ||
end | ||
|
||
test "Unauthenticated user can not access edit passsword page" do | ||
get edit_user_password_path | ||
assert_redirected_to new_user_session_path | ||
end | ||
|
||
test "Authenticated users should change password from profile page only" do | ||
sign_in users(:one) | ||
get new_user_password_path | ||
assert_redirected_to root_path | ||
end | ||
|
||
test "Authenticated users should edit password from profile page only" do | ||
sign_in users(:one) | ||
get edit_user_password_path | ||
assert_redirected_to root_path | ||
end | ||
|
||
#TODO: Do we need to test updates on /users/password? | ||
# test "Authenticated users can edit password" do | ||
# sign_in users(:one) | ||
# user = users(:one) | ||
# put user_password_path, user:user | ||
# assert_response :ok | ||
# end | ||
end |
This file was deleted.
Oops, something went wrong.