Skip to content

Commit

Permalink
Merge pull request #3664 from rubyforgood/fix-tests-jun13
Browse files Browse the repository at this point in the history
Fix tests jun13
  • Loading branch information
cielf authored Jun 20, 2023
2 parents 1cd3e97 + eaaf887 commit 9a1b4c4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ def current_partner
helper_method :current_partner

def current_role
role = Role.find_by(id: session[:current_role]) || UsersRole.current_role_for(current_user)
session[:current_role] = role&.id
return @role if @role

role
@role = Role.find_by(id: session[:current_role]) || UsersRole.current_role_for(current_user)
session[:current_role] = @role&.id

@role
end

def organization_url_options(options = {})
Expand Down
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def switch_to_role
return
end

@role = role
session[:current_role] = params[:role_id]
redirect_to dashboard_path_from_current_role
end
Expand Down
1 change: 1 addition & 0 deletions spec/factories/partners/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
factory :partner_profile, class: Partners::Profile do
partner { Partner.first || create(:partner) }
essentials_bank_id { Organization.try(:first).id || create(:organization).id }
website { "http://some-site.org" }
end
end
2 changes: 1 addition & 1 deletion spec/requests/admin/organizations_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
expect {
post admin_organizations_path({ organization: valid_organization_params })
}.to change(Organization, :count).by(1)
expect(response).to redirect_to(admin_organizations_path(organization_id: Organization.first.short_name))
expect(response).to redirect_to(admin_organizations_path(organization_id: 'admin'))
end
end

Expand Down

0 comments on commit 9a1b4c4

Please sign in to comment.