Fix default dashboard actions factories
We had a trait called `:admin_request` for actions that are requests to
administrators, but the default factories were also requests to
administrators.
The tests checking that the "Request" button is not present, which
shouldn't pass with the wrong default factories, were passing by
coincidence. The issue was that we weren't checking whether that the
request had finished before checking that the "Request" button wasn't
present. That meant that we were checking that the "Request" button
wasn't there right at the moment we pressed the link, before the request
was finished.
So we're now checking that the request is finished before checking that
the button isn't there.
On the other hand, the tests checking for the "Request resource" link
being present were checking a behavior that's no longer there since
commit 9d85b3935, when we changed the conditions affecting that link.
This commit is contained in:
@@ -142,7 +142,7 @@ FactoryBot.define do
|
||||
factory :dashboard_action, class: "Dashboard::Action" do
|
||||
title { Faker::Lorem.sentence[0..79].strip }
|
||||
description { Faker::Lorem.sentence }
|
||||
request_to_administrators { true }
|
||||
request_to_administrators { false }
|
||||
day_offset { 0 }
|
||||
required_supports { 0 }
|
||||
order { 0 }
|
||||
|
||||
@@ -178,7 +178,7 @@ describe "Proposal's dashboard" do
|
||||
expect(page).to have_content(solved.title)
|
||||
|
||||
within "div#dashboard_action_#{available.id}" do
|
||||
expect(page).to have_link("Request resource")
|
||||
expect(page).to have_link "See resource"
|
||||
end
|
||||
|
||||
within "div#dashboard_action_#{requested.id}" do
|
||||
@@ -225,7 +225,7 @@ describe "Proposal's dashboard" do
|
||||
expect(page).to have_content(solved.title)
|
||||
|
||||
within "div#dashboard_action_#{available.id}" do
|
||||
expect(page).to have_link("Request resource")
|
||||
expect(page).to have_link "See resource"
|
||||
end
|
||||
|
||||
within "div#dashboard_action_#{requested.id}" do
|
||||
@@ -308,7 +308,8 @@ describe "Proposal's dashboard" do
|
||||
visit proposal_dashboard_path(proposal)
|
||||
click_link(feature.title)
|
||||
|
||||
expect(page).not_to have_button("Request")
|
||||
expect(page).to have_content feature.description
|
||||
expect(page).not_to have_button "Request"
|
||||
end
|
||||
|
||||
scenario "Resource admin request button do not appear on archived proposals" do
|
||||
@@ -323,8 +324,8 @@ describe "Proposal's dashboard" do
|
||||
click_link(feature.title)
|
||||
end
|
||||
|
||||
expect(page).not_to have_button("Request")
|
||||
expect(page).to have_content("This proposal is archived and can not request resources.")
|
||||
expect(page).to have_content "This proposal is archived and can not request resources."
|
||||
expect(page).not_to have_button "Request"
|
||||
end
|
||||
|
||||
scenario "Dashboard has a link to dashboard community" do
|
||||
|
||||
Reference in New Issue
Block a user