Browse Source

Update tests

pull/2606/head
Manny Dinssa 2 years ago
parent
commit
0daf88bbbd
  1. 12
      spec/requests/merge_requests_controller_spec.rb
  2. 10
      spec/views/merge_requests/show.html.erb_spec.rb

12
spec/requests/merge_requests_controller_spec.rb

@ -485,8 +485,8 @@ RSpec.describe MergeRequestsController, type: :request do
it "shows users and schemes count and has links to view merge outcomes" do it "shows users and schemes count and has links to view merge outcomes" do
expect(page).to have_link("View", href: scheme_outcomes_merge_request_path(merge_request)) expect(page).to have_link("View", href: scheme_outcomes_merge_request_path(merge_request))
expect(page).to have_content("4 Users") expect(page).to have_content("4 users")
expect(page).to have_content("4 Schemes") expect(page).to have_content("4 schemes")
end end
end end
@ -496,13 +496,13 @@ RSpec.describe MergeRequestsController, type: :request do
it "shows saved users count and doesn't have links to view merge outcomes" do it "shows saved users count and doesn't have links to view merge outcomes" do
expect(merge_request.status).to eq("request_merged") expect(merge_request.status).to eq("request_merged")
expect(page).not_to have_link("View", href: user_outcomes_merge_request_path(merge_request)) expect(page).not_to have_link("View", href: user_outcomes_merge_request_path(merge_request))
expect(page).to have_content("34 Users") expect(page).to have_content("34 users")
end end
it "shows saved schemes count and doesn't have links to view merge outcomes" do it "shows saved schemes count and doesn't have links to view merge outcomes" do
expect(merge_request.status).to eq("request_merged") expect(merge_request.status).to eq("request_merged")
expect(page).not_to have_link("View", href: scheme_outcomes_merge_request_path(merge_request)) expect(page).not_to have_link("View", href: scheme_outcomes_merge_request_path(merge_request))
expect(page).to have_content("12 Schemes") expect(page).to have_content("12 schemes")
end end
end end
@ -512,13 +512,13 @@ RSpec.describe MergeRequestsController, type: :request do
it "shows saved users count and doesn't have links to view merge outcomes" do it "shows saved users count and doesn't have links to view merge outcomes" do
expect(merge_request.status).to eq("processing") expect(merge_request.status).to eq("processing")
expect(page).not_to have_link("View", href: user_outcomes_merge_request_path(merge_request)) expect(page).not_to have_link("View", href: user_outcomes_merge_request_path(merge_request))
expect(page).to have_content("51 Users") expect(page).to have_content("51 users")
end end
it "shows saved schemes count and doesn't have links to view merge outcomes" do it "shows saved schemes count and doesn't have links to view merge outcomes" do
expect(merge_request.status).to eq("processing") expect(merge_request.status).to eq("processing")
expect(page).not_to have_link("View", href: scheme_outcomes_merge_request_path(merge_request)) expect(page).not_to have_link("View", href: scheme_outcomes_merge_request_path(merge_request))
expect(page).to have_content("33 Schemes") expect(page).to have_content("33 schemes")
end end
end end
end end

10
spec/views/merge_requests/show.html.erb_spec.rb

@ -84,12 +84,10 @@ RSpec.describe "merge_requests/show.html.erb", type: :view do
it "displays the total stock owners & managing agents after merge details" do it "displays the total stock owners & managing agents after merge details" do
expect(rendered).to have_selector("dt", text: "Total stock owners & managing agents after merge") expect(rendered).to have_selector("dt", text: "Total stock owners & managing agents after merge")
if merge_request.total_stock_owners.present? || merge_request.total_managing_agents.present? combined_text = []
combined_text = [] combined_text << "#{merge_request.total_stock_owners} stock owners" if merge_request.total_stock_owners.present?
combined_text << "#{merge_request.total_stock_owners} stock owners" if merge_request.total_stock_owners.present? combined_text << "#{merge_request.total_managing_agents} managing agents" if merge_request.total_managing_agents.present?
combined_text << "#{merge_request.total_managing_agents} managing agents" if merge_request.total_managing_agents.present? expect(rendered).to have_selector("dd", text: combined_text.join("\n"))
expect(rendered).to have_selector("dd", text: combined_text.join(""))
end
end end
end end
end end

Loading…
Cancel
Save