Browse Source

failing test viewing logs for specific org as support user

pull/643/head
JG 3 years ago
parent
commit
4d4b9f17df
  1. 105
      spec/helpers/title_helper_spec.rb

105
spec/helpers/title_helper_spec.rb

@ -20,68 +20,95 @@ RSpec.describe TitleHelper do
let(:search_item) { nil } let(:search_item) { nil }
let(:count) { 1 } let(:count) { 1 }
context "organisation path" do context "highest level links" do
let(:path) { "/organisations" } context "organisation path" do
let(:page_title) { "Organisations" } let(:path) { "/organisations" }
let(:page_title) { "Organisations" }
context "search is missing" do context "search is missing" do
let(:expected_title) { page_title } let(:expected_title) { page_title }
it "returns expected title when no search" do it "returns expected title when no search" do
expect(format_title(path, nil, page_title, user, item_label, count)).to eq(expected_title) expect(format_title(path, nil, page_title, user, item_label, count)).to eq(expected_title)
end
end end
end
context "search is present" do context "search is present" do
let(:search_item) { "foobar" } let(:search_item) { "foobar" }
let(:expected_title) { "#{page_title} (#{count} #{item_label} matching ‘#{search_item}’)" } let(:expected_title) { "#{page_title} (#{count} #{item_label} matching ‘#{search_item}’)" }
it "returns expected title when search is present" do it "returns expected title when search is present" do
expect(format_title(path, search_item, page_title, user, item_label, count)).to eq(expected_title) expect(format_title(path, search_item, page_title, user, item_label, count)).to eq(expected_title)
end
end end
end end
end
context "users path" do context "users path" do
let(:path) { "/users" } let(:path) { "/users" }
let(:page_title) { "Users" } let(:page_title) { "Users" }
context "search is missing" do
let(:expected_title) { page_title }
it "returns expected title when no search" do
expect(format_title(path, nil, page_title, user, item_label, count)).to eq(expected_title)
end
end
context "search is missing" do context "search is present" do
let(:expected_title) { page_title } let(:search_item) { "foobar" }
let(:expected_title) { "#{page_title} (#{count} #{item_label} matching ‘#{search_item}’)" }
it "returns expected title when no search" do it "returns expected title when search is present" do
expect(format_title(path, nil, page_title, user, item_label, count)).to eq(expected_title) expect(format_title(path, search_item, page_title, user, item_label, count)).to eq(expected_title)
end
end end
end end
context "search is present" do context "logs path" do
let(:search_item) { "foobar" } let(:path) { "/logs" }
let(:expected_title) { "#{page_title} (#{count} #{item_label} matching ‘#{search_item}’)" } let(:page_title) { "Logs" }
it "returns expected title when search is present" do context "search is missing" do
expect(format_title(path, search_item, page_title, user, item_label, count)).to eq(expected_title) let(:expected_title) { page_title }
it "returns expected title when no search" do
expect(format_title(path, nil, page_title, user, item_label, count)).to eq(expected_title)
end
end
context "search is present" do
let(:search_item) { "foobar" }
let(:expected_title) { "#{page_title} (#{count} #{item_label} matching ‘#{search_item}’)" }
it "returns expected title when search is present" do
expect(format_title(path, search_item, page_title, user, item_label, count)).to eq(expected_title)
end
end end
end end
end end
context "logs path" do context "sub nav links" do
let(:path) { "/logs" } context "specific organisation logs path" do
let(:page_title) { "Logs" } let(:path) { "organisations/1/logs" }
let(:page_title) { "Logs" }
let(:organisation_name) { "Some Name" }
context "search is missing" do context "search is missing" do
let(:expected_title) { page_title } let(:expected_title) { "#{organisation_name} (#{page_title})" }
it "returns expected title when no search" do it "returns expected title when no search" do
expect(format_title(path, nil, page_title, user, item_label, count)).to eq(expected_title) expect(format_title(path, nil, page_title, user, item_label, count)).to eq(expected_title)
end
end end
end
context "search is present" do context "search is present" do
let(:search_item) { "foobar" } let(:search_item) { "foobar" }
let(:expected_title) { "#{page_title} (#{count} #{item_label} matching ‘#{search_item}’)" } let(:expected_title) { "#{organisation_name} (#{count} #{item_label} matching ‘#{search_item}’)" }
it "returns expected title when search is present" do it "returns expected title when search is present" do
expect(format_title(path, search_item, page_title, user, item_label, count)).to eq(expected_title) expect(format_title(path, search_item, page_title, user, item_label, count)).to eq(expected_title)
end
end end
end end
end end

Loading…
Cancel
Save