Browse Source

Test filter presence

pull/522/head
baarkerlounger 3 years ago
parent
commit
e7e82bef8f
  1. 2
      spec/helpers/filters_helper_spec.rb
  2. 18
      spec/requests/case_logs_controller_spec.rb

2
spec/helpers/filters_helper_spec.rb

@ -51,7 +51,7 @@ RSpec.describe FiltersHelper do
before do before do
session[:case_logs_filters] = {}.to_json session[:case_logs_filters] = {}.to_json
end end
it "defaults to all organisations" do it "defaults to all organisations" do
expect(filter_selected?("organisation_select", :all)).to be true expect(filter_selected?("organisation_select", :all)).to be true
expect(filter_selected?("organisation_select", :specific_org)).to be false expect(filter_selected?("organisation_select", :specific_org)).to be false

18
spec/requests/case_logs_controller_spec.rb

@ -351,6 +351,24 @@ RSpec.describe CaseLogsController, type: :request do
it "shows the download csv link" do it "shows the download csv link" do
expect(page).to have_link("Download (CSV)", href: "/logs.csv") expect(page).to have_link("Download (CSV)", href: "/logs.csv")
end end
it "does not show the organisation filter" do
expect(page).not_to have_field("organisation-field")
end
end
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
get "/logs", headers:, params: {}
end
it "does show the organisation filter" do
expect(page).to have_field("organisation-field")
end
end end
context "when there are more than 20 logs" do context "when there are more than 20 logs" do

Loading…
Cancel
Save