|
|
|
@ -159,10 +159,32 @@ RSpec.describe CaseLogsController, type: :request do
|
|
|
|
|
context "when displaying a collection of logs" do |
|
|
|
|
let(:headers) { { "Accept" => "text/html" } } |
|
|
|
|
|
|
|
|
|
context "when the user is a customer support user" do |
|
|
|
|
let(:user) { FactoryBot.create(:user, :support) } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
|
sign_in user |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does have organisation columns" do |
|
|
|
|
get "/logs", headers: headers, params: {} |
|
|
|
|
expect(CGI.unescape_html(response.body)).to match(/<th class="govuk-table__header" scope="col">Owning organisation<\/th>/) |
|
|
|
|
expect(CGI.unescape_html(response.body)).to match(/<th class="govuk-table__header" scope="col">Managing organisation<\/th>/) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the user is not a customer support user" do |
|
|
|
|
before do |
|
|
|
|
sign_in user |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "does not have organisation columns" do |
|
|
|
|
get "/logs", headers: headers, params: {} |
|
|
|
|
expect(CGI.unescape_html(response.body)).not_to match(/<th class="govuk-table__header" scope="col">Owning organisation<\/th>/) |
|
|
|
|
expect(CGI.unescape_html(response.body)).not_to match(/<th class="govuk-table__header" scope="col">Managing organisation<\/th>/) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when there are less than 20 logs" do |
|
|
|
|
before do |
|
|
|
|
get "/logs", headers: headers, params: {} |
|
|
|
@ -263,6 +285,7 @@ RSpec.describe CaseLogsController, type: :request do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when requesting a specific case log" do |
|
|
|
|
let(:completed_case_log) { FactoryBot.create(:case_log, :completed) } |
|
|
|
|