Skip to content

Commit

Permalink
Tweak integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colby-swandale committed Nov 13, 2024
1 parent 555736f commit 52f2075
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ class Organizations::Onboarding::ConfirmControllerTest < ActionDispatch::Integra
assert page.has_content?("Organization onboarded successfully")

assert_predicate @organization_onboarding.reload, :completed?
assert_predicate @organization_onboarding.organization, :present?

organization = @organization_onboarding.organization

assert_equal organization, @organization_onboarding.organization
assert_equal organization, @user.organizations.first
assert_equal organization, @collaborator.organizations.first

assert_predicate @user.memberships.find_by(organization:), :owner?
assert_predicate @collaborator.memberships.find_by(organization:), :maintainer?

assert_equal @rubygem.reload.organization, organization
end

should "fail to onboard the organization and render an error message" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Organizations::Onboarding::NameControllerTest < ActionController::TestCase
should "create a new onboarding and redirect to the next step" do
post :create, params: { organization_onboarding: { organization_name: "New Name", organization_handle: @gem.name, name_type: "gem" } }

assert OrganizationOnboarding.exists?(organization_name: "New Name", organization_handle: @gem.name, name_type: "gem")
assert_redirected_to organization_onboarding_gems_path
end

Expand Down
6 changes: 3 additions & 3 deletions test/integration/organizations/onboarding_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Organizations::OnboardingControllerTest < ActionDispatch::IntegrationTest
delete "/organizations/onboarding"

assert_redirected_to dashboard_path
assert OrganizationOnboarding.find_by(id: organization_onboarding.id)
assert OrganizationOnboarding.exists?(id: organization_onboarding.id)
end

should "destroy a pending OrganizationOnboarding created by the current user" do
Expand All @@ -30,7 +30,7 @@ class Organizations::OnboardingControllerTest < ActionDispatch::IntegrationTest
delete "/organizations/onboarding"

assert_redirected_to dashboard_path
assert_nil OrganizationOnboarding.find_by(id: organization_onboarding.id)
refute OrganizationOnboarding.exists?(id: organization_onboarding.id)
end

should "destroy a failed OrganizationOnboarding created by the current user" do
Expand All @@ -39,7 +39,7 @@ class Organizations::OnboardingControllerTest < ActionDispatch::IntegrationTest
delete "/organizations/onboarding"

assert_redirected_to dashboard_path
assert_nil OrganizationOnboarding.find_by(id: organization_onboarding.id)
refute OrganizationOnboarding.exists?(id: organization_onboarding.id)
end

should "redirect to the dashboarding if the current user has not started organization onboarding" do
Expand Down

0 comments on commit 52f2075

Please sign in to comment.