Browse Source

CLDC-2328: Button uses post instead of get, tests reflect this.

pull/1680/head
Aaron Spencer 3 years ago
parent
commit
0621b26aec
  1. 2
      config/routes.rb
  2. 20
      spec/requests/users_controller_spec.rb

2
config/routes.rb

@ -103,7 +103,7 @@ Rails.application.routes.draw do
member do
get "deactivate", to: "users#deactivate"
get "reactivate", to: "users#reactivate"
get "resend-invite", to: "users#resend_invite"
post "resend-invite", to: "users#resend_invite"
end
end

20
spec/requests/users_controller_spec.rb

@ -99,8 +99,8 @@ RSpec.describe UsersController, type: :request do
describe "#resend_invite" do
it "does not allow resending activation emails" do
get "/users/#{user.id}/deactivate", headers: headers, params: {}
expect(response).to redirect_to("/account/sign-in")
get deactivate_user_path(user.id), headers: headers, params: {}
expect(response).to redirect_to(new_user_session_path)
end
end
end
@ -131,7 +131,7 @@ RSpec.describe UsersController, type: :request do
end
it "does not allow resending invitation emails" do
expect(page).not_to have_link("Resend invite link", href: "/users/#{other_user.id}/resend-invite")
expect(page).not_to have_button("Resend invite link")
end
context "when user is deactivated" do
@ -201,7 +201,7 @@ RSpec.describe UsersController, type: :request do
end
it "does not allow resending invitation emails" do
expect(page).not_to have_link("Resend invite link", href: "/users/#{other_user.id}/resend-invite")
expect(page).not_to have_button("Resend invite link")
end
end
end
@ -520,7 +520,7 @@ RSpec.describe UsersController, type: :request do
end
it "does not allow resending invitation emails" do
expect(page).not_to have_link("Resend invite link", href: "/users/#{other_user.id}/resend-invite")
expect(page).not_to have_button("Resend invite link")
end
end
end
@ -553,8 +553,8 @@ RSpec.describe UsersController, type: :request do
expect(page).to have_link("Deactivate user", href: "/users/#{other_user.id}/deactivate")
end
it "allows you to resend invitation emails" do
expect(page).to have_link("Resend invite link", href: "/users/#{other_user.id}/resend-invite")
it "does not allow you to resend invitation emails" do
expect(page).not_to have_button("Resend invite link")
end
context "when user is deactivated" do
@ -572,7 +572,7 @@ RSpec.describe UsersController, type: :request do
end
it "does not allow you to resend invitation emails" do
expect(page).not_to have_link("Resend invite link", href: "/users/#{other_user.id}/resend-invite")
expect(page).not_to have_button("Resend invite link")
end
end
end
@ -1204,6 +1204,10 @@ RSpec.describe UsersController, type: :request do
expect(page).to have_link("Deactivate user", href: "/users/#{other_user.id}/deactivate")
end
it "allows you to resend invitation emails" do
expect(page).to have_button("Resend invite link")
end
context "when user is deactivated" do
before do
other_user.update!(active: false)

Loading…
Cancel
Save