Files
nairobi/spec/shared/system/milestoneable.rb
Javi Martín 7c6134fdee Unify the way we display document information
We were displaying documents in five places, and in five different ways.
Sometimes with the metadata in parenthesis after the title, sometimes
with the metadata below the title, sometimes without metadata, sometimes
with an icon in front of the document, and sometimes with a separate
link to download the file.

So we're now displaying the same thing everywhere. Not sure whether this
is the best solution, but at least it's consistent.

We aren't unifying the way we display a list of documents, though, since
different sections look pretty different and I'm not sure whether the
same style would look well everywhere.

Note that we're renaming the `document` HTML class in the documents
table to `document-row` so the styles for the `document` class don't
apply here.
2023-10-23 18:15:54 +02:00

60 lines
2.1 KiB
Ruby

shared_examples "milestoneable" do |factory_name|
it_behaves_like "progressable", factory_name
let!(:milestoneable) { create(factory_name) }
describe "Show milestones" do
let(:path) { polymorphic_path(milestoneable) }
scenario "Show milestones" do
create(:milestone, milestoneable: milestoneable,
description_en: "Last milestone with a link to https://consul.dev",
description_es: "Último hito con el link https://consul.dev",
publication_date: Date.tomorrow)
first_milestone = create(:milestone, milestoneable: milestoneable,
description: "First milestone",
publication_date: Date.yesterday)
image = create(:image, imageable: first_milestone)
document = create(:document, documentable: first_milestone)
login_as(create(:user))
visit path
find("#tab-milestones-label").click
within("#tab-milestones") do
expect(first_milestone.description).to appear_before("Last milestone with a link to https://consul.dev")
expect(page).to have_content(Date.tomorrow)
expect(page).to have_content(Date.yesterday)
expect(page).not_to have_content(Date.current)
expect(page.find("#image_#{first_milestone.id}")["alt"]).to have_content(image.title)
expect(page).to have_link text: document.title
expect(page).to have_link("https://consul.dev")
expect(page).to have_content(first_milestone.status.name)
end
select "Español", from: "Language:"
find("#tab-milestones-label").click
within("#tab-milestones") do
expect(page).to have_content("Último hito con el link https://consul.dev")
expect(page).to have_link("https://consul.dev")
end
end
scenario "Show no_milestones text" do
login_as(create(:user))
visit path
find("#tab-milestones-label").click
within("#tab-milestones") do
expect(page).to have_content("Don't have defined milestones")
end
end
end
end