-
-
Notifications
You must be signed in to change notification settings - Fork 926
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test coverage for organziation/onboarding controller
- Loading branch information
1 parent
e4228d7
commit 0d7a94b
Showing
4 changed files
with
64 additions
and
25 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
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,42 @@ | ||
require "test_helper" | ||
|
||
class Organizations::OnboardingControllerTest < ActionDispatch::IntegrationTest | ||
setup do | ||
@user = create(:user, remember_token_expires_at: Gemcutter::REMEMBER_FOR.from_now) | ||
post session_path(session: { who: @user.handle, password: PasswordHelpers::SECURE_TEST_PASSWORD }) | ||
end | ||
|
||
context "GET /organizations/onboarding" do | ||
should "redirect to onboarding start page" do | ||
get "/organizations/onboarding" | ||
|
||
assert_redirected_to organization_onboarding_name_path | ||
end | ||
end | ||
|
||
context "DELETE /organizations/onboarding" do | ||
should "not destroy an OrganizationOnboarding that is already completed" do | ||
organization_onboarding = create(:organization_onboarding, :completed, created_by: @user) | ||
|
||
delete "/organizations/onboarding" | ||
|
||
assert_redirected_to dashboard_path | ||
assert OrganizationOnboarding.find_by(id: organization_onboarding.id) | ||
end | ||
|
||
should "destroy an existing OrganizationOnboarding created by the current user" do | ||
organization_onboarding = create(:organization_onboarding, created_by: @user) | ||
|
||
delete "/organizations/onboarding" | ||
|
||
assert_redirected_to dashboard_path | ||
assert_nil OrganizationOnboarding.find_by(id: organization_onboarding.id) | ||
end | ||
|
||
should "redirect to the dashboarding if the current user has not started organization onboarding" do | ||
delete "/organizations/onboarding" | ||
|
||
assert_redirected_to dashboard_path | ||
end | ||
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