|
|
|
@ -20,12 +20,34 @@ RSpec.describe DuplicateLogsController, type: :request do |
|
|
|
) |
|
|
|
) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "GET" do |
|
|
|
|
|
|
|
context "when user is not signed in" do |
|
|
|
|
|
|
|
it "redirects to sign in page" do |
|
|
|
|
|
|
|
get "/lettings-logs/#{lettings_log.id}/duplicate-logs" |
|
|
|
|
|
|
|
expect(response).to redirect_to("/account/sign-in") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when the user is from different organisation" do |
|
|
|
|
|
|
|
let(:other_user) { create(:user) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
allow(other_user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
|
|
|
|
sign_in other_user |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "renders page not found" do |
|
|
|
|
|
|
|
get "/lettings-logs/#{lettings_log.id}/duplicate-logs" |
|
|
|
|
|
|
|
expect(response).to have_http_status(:not_found) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when user is signed in" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
sign_in user |
|
|
|
sign_in user |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "GET" do |
|
|
|
|
|
|
|
context "with multiple duplicate lettings logs" do |
|
|
|
context "with multiple duplicate lettings logs" do |
|
|
|
let(:duplicate_logs) { create_list(:lettings_log, 2, :completed) } |
|
|
|
let(:duplicate_logs) { create_list(:lettings_log, 2, :completed) } |
|
|
|
|
|
|
|
|
|
|
|
@ -89,3 +111,4 @@ RSpec.describe DuplicateLogsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|