|
|
|
@ -2411,6 +2411,10 @@ RSpec.describe UsersController, type: :request do |
|
|
|
|
|
|
|
|
|
|
|
describe "#log_reassignment" do |
|
|
|
describe "#log_reassignment" do |
|
|
|
context "when organisation id is not given" do |
|
|
|
context "when organisation id is not given" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
create(:lettings_log, assigned_to: other_user) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "redirects to the user page" do |
|
|
|
it "redirects to the user page" do |
|
|
|
get "/users/#{other_user.id}/log-reassignment" |
|
|
|
get "/users/#{other_user.id}/log-reassignment" |
|
|
|
expect(response).to redirect_to("/users/#{other_user.id}") |
|
|
|
expect(response).to redirect_to("/users/#{other_user.id}") |
|
|
|
@ -2418,6 +2422,10 @@ RSpec.describe UsersController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when organisation id does not exist" do |
|
|
|
context "when organisation id does not exist" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
create(:lettings_log, assigned_to: other_user) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "redirects to the user page" do |
|
|
|
it "redirects to the user page" do |
|
|
|
get "/users/#{other_user.id}/log-reassignment?organisation_id=123123" |
|
|
|
get "/users/#{other_user.id}/log-reassignment?organisation_id=123123" |
|
|
|
expect(response).to redirect_to("/users/#{other_user.id}") |
|
|
|
expect(response).to redirect_to("/users/#{other_user.id}") |
|
|
|
@ -2427,6 +2435,7 @@ RSpec.describe UsersController, type: :request do |
|
|
|
context "with valid organisation id" do |
|
|
|
context "with valid organisation id" do |
|
|
|
let(:new_organisation) { create(:organisation, name: "new org") } |
|
|
|
let(:new_organisation) { create(:organisation, name: "new org") } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "and user has assigned logs" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
create(:lettings_log, assigned_to: other_user) |
|
|
|
create(:lettings_log, assigned_to: other_user) |
|
|
|
end |
|
|
|
end |
|
|
|
@ -2440,6 +2449,14 @@ RSpec.describe UsersController, type: :request do |
|
|
|
expect(page).to have_link("Cancel", href: "/users/#{other_user.id}/edit") |
|
|
|
expect(page).to have_link("Cancel", href: "/users/#{other_user.id}/edit") |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "and user has no assigned logs" do |
|
|
|
|
|
|
|
it "redirects to confirm organisation change page" do |
|
|
|
|
|
|
|
get "/users/#{other_user.id}/log-reassignment?organisation_id=#{new_organisation.id}" |
|
|
|
|
|
|
|
expect(response).to redirect_to("/users/#{other_user.id}/organisation-change-confirmation?organisation_id=#{new_organisation.id}") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#confirm_organisation_change" do |
|
|
|
describe "#confirm_organisation_change" do |
|
|
|
|