Files
grecia/spec/features/dashboard/poster_spec.rb
Javi Martín 307cf24846 Use describe on feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
2019-05-28 16:36:54 +02:00

42 lines
1.0 KiB
Ruby

require "rails_helper"
describe "Poster" do
let!(:proposal) { create(:proposal, :draft) }
before do
login_as(proposal.author)
visit new_proposal_dashboard_poster_path(proposal)
end
scenario "Has a link to preview the poster" do
expect(page).to have_link("Preview")
end
scenario "Has a link to download the poster" do
expect(page).to have_link("Download")
end
scenario "Preview contains the proposal details" do
click_link "Preview"
expect(page).to have_content(proposal.title)
expect(page).to have_content(proposal.code)
end
scenario "Preview page can download the poster as well" do
click_link "Preview"
expect(page).not_to have_link("Preview")
expect(page).to have_link("Download")
end
scenario "PDF contains the proposal details", js: true do
click_link "Download"
page.driver.browser.switch_to.window page.driver.browser.window_handles.last do
expect(page).to have_content(proposal.title)
expect(page).to have_content(proposal.code)
end
end
end