Browse Source

Fix heisenspec (#621)

* Check for link with log id rather than just log id anywhere in html

* Same fix for controller spec

* Same fix for the log spec
pull/622/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
0f442ccb57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      spec/features/log_spec.rb
  2. 6
      spec/features/organisation_spec.rb
  3. 34
      spec/requests/case_logs_controller_spec.rb

20
spec/features/log_spec.rb

@ -16,9 +16,9 @@ RSpec.describe "Log Features" do
end
it "displays the logs belonging to the same organisation" do
expect(page).to have_content(log_to_search.id)
expect(page).to have_content(same_organisation_log.id)
expect(page).not_to have_content(another_organisation_log.id)
expect(page).to have_link(log_to_search.id.to_s)
expect(page).to have_link(same_organisation_log.id.to_s)
expect(page).not_to have_link(another_organisation_log.id.to_s)
end
context "when I search for a specific log" do
@ -35,9 +35,9 @@ RSpec.describe "Log Features" do
end
it "displays log matching the log ID" do
expect(page).to have_content(log_to_search.id)
expect(page).not_to have_content(same_organisation_log.id)
expect(page).not_to have_content(another_organisation_log.id)
expect(page).to have_link(log_to_search.id.to_s)
expect(page).not_to have_link(same_organisation_log.id.to_s)
expect(page).not_to have_link(another_organisation_log.id.to_s)
end
context "when I want to clear results" do
@ -45,11 +45,11 @@ RSpec.describe "Log Features" do
expect(page).to have_link("Clear search")
end
it "displays the logs belonging to the same organisation after I clear the search result after I clear the search resultss" do
it "displays the logs belonging to the same organisation after I clear the search results" do
click_link("Clear search")
expect(page).to have_content(log_to_search.id)
expect(page).to have_content(same_organisation_log.id)
expect(page).not_to have_content(another_organisation_log.id)
expect(page).to have_link(log_to_search.id.to_s)
expect(page).to have_link(same_organisation_log.id.to_s)
expect(page).not_to have_link(another_organisation_log.id.to_s)
end
end
end

6
spec/features/organisation_spec.rb

@ -122,9 +122,9 @@ RSpec.describe "User Features" do
end
it "displays log matching the log ID" do
expect(page).to have_content(log_to_search.id)
expect(page).to have_link(log_to_search.id.to_s)
other_logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_link(log.id.to_s)
end
end
@ -135,7 +135,7 @@ RSpec.describe "User Features" do
it "displays the logs belonging to the same organisation after I clear the search result after I clear the search resultss" do
click_link("Clear search")
expect(page).to have_content(log_to_search.id)
expect(page).to have_link(log_to_search.id.to_s)
end
end
end

34
spec/requests/case_logs_controller_spec.rb

@ -330,33 +330,33 @@ RSpec.describe CaseLogsController, type: :request do
it "shows case logs matching the id" do
get "/logs?search=#{log_to_search.id}", headers: headers, params: {}
expect(page).to have_content(log_to_search.id)
expect(page).to have_content(log_to_search.id.to_s)
logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_content(log.id.to_s)
end
end
it "shows case logs matching the tenant code" do
get "/logs?search=#{log_to_search.tenant_code}", headers: headers, params: {}
expect(page).to have_content(log_to_search.id)
expect(page).to have_link(log_to_search.id.to_s)
logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_link(log.id.to_s)
end
end
it "shows case logs matching the property reference" do
get "/logs?search=#{log_to_search.propcode}", headers: headers, params: {}
expect(page).to have_content(log_to_search.id)
expect(page).to have_content(log_to_search.id.to_s)
logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_link(log.id.to_s)
end
end
it "shows case logs matching the property postcode" do
get "/logs?search=#{log_to_search.postcode_full}", headers: headers, params: {}
expect(page).to have_content(log_to_search.id)
expect(page).to have_link(log_to_search.id.to_s)
logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_link(log.id.to_s)
end
end
@ -365,10 +365,10 @@ RSpec.describe CaseLogsController, type: :request do
it "displays all matching logs" do
get "/logs?search=#{log_to_search.postcode_full}", headers: headers, params: {}
expect(page).to have_content(log_to_search.id)
expect(page).to have_link(log_to_search.id.to_s)
expect(page).to have_content(matching_postcode_log.id)
logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_link(log.id.to_s)
end
end
end
@ -391,9 +391,9 @@ RSpec.describe CaseLogsController, type: :request do
it "doesn't display any logs" do
get "/logs?search=foobar", headers:, params: {}
logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_link(log.id.to_s)
end
expect(page).not_to have_content(log_to_search.id)
expect(page).not_to have_link(log_to_search.id.to_s)
end
end
@ -401,9 +401,9 @@ RSpec.describe CaseLogsController, type: :request do
it "doesn't display any logs" do
get "/logs?search=", headers:, params: {}
logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_link(log.id.to_s)
end
expect(page).not_to have_content(log_to_search.id)
expect(page).not_to have_link(log_to_search.id.to_s)
end
end
@ -414,10 +414,10 @@ RSpec.describe CaseLogsController, type: :request do
it "shows only logs matching both search and filters" do
get "/logs?search=#{matching_postcode}&status[]=#{matching_status}", headers: headers, params: {}
expect(page).to have_content(log_matching_filter_and_search.id)
expect(page).not_to have_content(log_to_search.id)
expect(page).to have_link(log_matching_filter_and_search.id.to_s)
expect(page).not_to have_link(log_to_search.id.to_s)
logs.each do |log|
expect(page).not_to have_content(log.id)
expect(page).not_to have_link(log.id.to_s)
end
end
end

Loading…
Cancel
Save