diff --git a/spec/system/admin/legislation/processes_spec.rb b/spec/system/admin/legislation/processes_spec.rb index 4b0e54817..1ce14063c 100644 --- a/spec/system/admin/legislation/processes_spec.rb +++ b/spec/system/admin/legislation/processes_spec.rb @@ -186,7 +186,7 @@ describe "Admin collaborative legislation", :admin do expect(page).to have_content "An example legislation process" expect(page).not_to have_content "Summary of the process" - expect(page).to have_css("img[alt='#{Legislation::Process.last.title}']") + expect(page).to have_css("img[alt='An example legislation process']") end scenario "Default colors are present" do diff --git a/spec/system/admin/poll/active_polls_spec.rb b/spec/system/admin/poll/active_polls_spec.rb index 2f332b5f2..2db50c902 100644 --- a/spec/system/admin/poll/active_polls_spec.rb +++ b/spec/system/admin/poll/active_polls_spec.rb @@ -2,16 +2,19 @@ require "rails_helper" describe "Admin Active polls", :admin do scenario "Add" do - expect(ActivePoll.first).to be nil - visit admin_polls_path click_link "Polls description" + expect(page).to have_ckeditor "Description", with: "" + fill_in_ckeditor "Description", with: "Active polls description" click_button "Save" expect(page).to have_content "Polls description updated successfully." - expect(ActivePoll.first.description).to eq "
Active polls description
\r\n" + + click_link "Polls description" + + expect(page).to have_ckeditor "Description", with: "Active polls description" end scenario "Edit" do diff --git a/spec/system/admin/tags_spec.rb b/spec/system/admin/tags_spec.rb index fd5acee45..45d17fad5 100644 --- a/spec/system/admin/tags_spec.rb +++ b/spec/system/admin/tags_spec.rb @@ -82,7 +82,10 @@ describe "Admin tags", :admin do click_button "Create topic" end - expect(Tag.category.where(name: "wow_category")).to exist + within "tbody" do + expect(page).to have_content "Existence" + expect(page).to have_content "wow_category" + end end end diff --git a/spec/system/admin/widgets/cards_spec.rb b/spec/system/admin/widgets/cards_spec.rb index e58868979..1621d90a6 100644 --- a/spec/system/admin/widgets/cards_spec.rb +++ b/spec/system/admin/widgets/cards_spec.rb @@ -25,7 +25,7 @@ describe "Cards", :admin do expect(page).to have_content "Card description" expect(page).to have_content "Link text" expect(page).to have_content "consul.dev" - expect(page).to have_link "Show image", href: Widget::Card.last.image_url(:large) + expect(page).to have_link "Show image", title: "clippy.jpg" end end end diff --git a/spec/system/emails_spec.rb b/spec/system/emails_spec.rb index 330869153..e352bba26 100644 --- a/spec/system/emails_spec.rb +++ b/spec/system/emails_spec.rb @@ -359,13 +359,12 @@ describe "Emails" do expect(page).to have_content "Investment created successfully" email = open_last_email - investment = Budget::Investment.last expect(email).to have_subject("Thank you for creating an investment!") - expect(email).to deliver_to(investment.author.email) + expect(email).to deliver_to(author.email) expect(email).to have_body_text(author.name) - expect(email).to have_body_text(investment.title) - expect(email).to have_body_text(investment.budget.name) + expect(email).to have_body_text("Build a hospital") + expect(email).to have_body_text(budget.name) expect(email).to have_body_text(budget_path(budget)) end @@ -383,12 +382,11 @@ describe "Emails" do click_button "Save changes" expect(page).to have_content "Dossier updated" - investment.reload email = open_last_email expect(email).to have_subject("Your investment project '#{investment.code}' has been marked as unfeasible") expect(email).to deliver_to(investment.author.email) - expect(email).to have_body_text(investment.unfeasibility_explanation) + expect(email).to have_body_text "This is not legal as stated in Article 34.9" end scenario "Selected investment" do diff --git a/spec/system/legislation/proposals_spec.rb b/spec/system/legislation/proposals_spec.rb index 04ed9cd52..d615cd8fc 100644 --- a/spec/system/legislation/proposals_spec.rb +++ b/spec/system/legislation/proposals_spec.rb @@ -152,7 +152,7 @@ describe "Legislation Proposals" do expect(page).to have_content "Legislation proposal with image" expect(page).to have_content "Including an image on a legislation proposal" - expect(page).to have_css("img[alt='#{Legislation::Proposal.last.image.title}']") + expect(page).to have_css "img[alt='clippy.jpg']" end scenario "Show votes score on index and show" do diff --git a/spec/system/management/managed_users_spec.rb b/spec/system/management/managed_users_spec.rb index 034d20933..2dc605ac0 100644 --- a/spec/system/management/managed_users_spec.rb +++ b/spec/system/management/managed_users_spec.rb @@ -99,12 +99,11 @@ describe "Managed User" do expect(page).to have_content "We have sent an email" expect(page).not_to have_content "Autogenerated password is" - user = User.last within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content user.username.to_s - expect(page).to have_content user.email.to_s - expect(page).to have_content user.document_number.to_s + expect(page).to have_content "pepe" + expect(page).to have_content "pepe@gmail.com" + expect(page).to have_content "12345678Z" end end @@ -127,11 +126,10 @@ describe "Managed User" do expect(page).not_to have_content "We have sent an email" expect(page).to have_content "Autogenerated password is" - user = User.last within(".account-info") do expect(page).to have_content "Identified as" - expect(page).to have_content user.username.to_s - expect(page).to have_content user.document_number.to_s + expect(page).to have_content "peppa" + expect(page).to have_content "12345678Z" end end end diff --git a/spec/system/proposals_spec.rb b/spec/system/proposals_spec.rb index e9fc118ab..76a851973 100644 --- a/spec/system/proposals_spec.rb +++ b/spec/system/proposals_spec.rb @@ -446,7 +446,12 @@ describe "Proposals" do click_link "No, I want to publish the proposal" click_link "Not now, go to my proposal" - expect(Proposal.last.responsible_name).to eq("Isabel Garcia") + click_link "Dashboard" + click_link "Edit my proposal" + + within_window(window_opened_by { click_link "Edit proposal" }) do + expect(page).to have_field "Full name of the person submitting the proposal", with: "Isabel Garcia" + end end scenario "Responsible name field is not shown for verified users" do diff --git a/spec/system/tags/proposals_spec.rb b/spec/system/tags/proposals_spec.rb index fd039d740..aba4b09b2 100644 --- a/spec/system/tags/proposals_spec.rb +++ b/spec/system/tags/proposals_spec.rb @@ -102,7 +102,9 @@ describe "Tags" do click_link "No, I want to publish the proposal" click_link "Not now, go to my proposal" - within "#tags_proposal_#{Proposal.last.id}" do + expect(page).to have_css "h1", exact_text: "Help refugees" + + within ".tags" do expect(page).to have_content "Education" expect(page).not_to have_content "Health" end