From fb71d20bcb163656df3bbe87cb1a4ceb1396ce7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Bol=C3=ADvar?= Date: Mon, 30 Oct 2023 13:35:56 +0100 Subject: [PATCH] Fix tests --- spec/system/account_spec.rb | 4 ++-- spec/system/block_email_edit_spec.rb | 2 +- spec/system/groups_verification_spec.rb | 2 +- spec/system/homepage_spec.rb | 2 +- spec/system/login_spec.rb | 2 +- spec/system/scoped_admins_spec.rb | 16 ++++++++-------- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/spec/system/account_spec.rb b/spec/system/account_spec.rb index 1ef40ff..eab3c83 100644 --- a/spec/system/account_spec.rb +++ b/spec/system/account_spec.rb @@ -3,8 +3,8 @@ require "rails_helper" describe "Visit the account page", type: :system do - let(:organization) { create :organization } - let(:user) { create :user, organization: organization } + let(:organization) { create :organization, external_domain_whitelist: %w(home.url registration.url) } + let(:user) { create :user, :confirmed, organization: organization } before do switch_to_host(organization.host) diff --git a/spec/system/block_email_edit_spec.rb b/spec/system/block_email_edit_spec.rb index baf60e9..7b567cd 100644 --- a/spec/system/block_email_edit_spec.rb +++ b/spec/system/block_email_edit_spec.rb @@ -10,7 +10,7 @@ end context "when visiting account page" do - let(:user) { create(:user, organization: organization) } + let(:user) { create(:user, :confirmed, organization: organization) } before do switch_to_host(organization.host) diff --git a/spec/system/groups_verification_spec.rb b/spec/system/groups_verification_spec.rb index 999e15b..38d858a 100644 --- a/spec/system/groups_verification_spec.rb +++ b/spec/system/groups_verification_spec.rb @@ -26,7 +26,7 @@ let!(:user) { create(:user, :confirmed, organization: organization) } - let!(:meeting) { create(:meeting, component: meetings_component, registrations_enabled: true) } + let!(:meeting) { create(:meeting, :published, component: meetings_component, registrations_enabled: true) } let!(:meetings_component) do create( diff --git a/spec/system/homepage_spec.rb b/spec/system/homepage_spec.rb index 7a93aee..ca51035 100644 --- a/spec/system/homepage_spec.rb +++ b/spec/system/homepage_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" describe "Visit the home page", type: :system, perform_enqueued: true do - let(:organization) { create :organization } + let(:organization) { create :organization, external_domain_whitelist: %w(home.url registration.url) } before do switch_to_host(organization.host) diff --git a/spec/system/login_spec.rb b/spec/system/login_spec.rb index 2a8a847..5c83219 100644 --- a/spec/system/login_spec.rb +++ b/spec/system/login_spec.rb @@ -3,7 +3,7 @@ require "rails_helper" describe "Visit the account page", type: :system do - let(:organization) { create :organization, users_registration_mode: "disabled" } + let(:organization) { create :organization, users_registration_mode: "disabled", external_domain_whitelist: %w(home.url registration.url) } let(:user) { create :user, organization: organization } before do diff --git a/spec/system/scoped_admins_spec.rb b/spec/system/scoped_admins_spec.rb index f531b17..9209105 100644 --- a/spec/system/scoped_admins_spec.rb +++ b/spec/system/scoped_admins_spec.rb @@ -5,7 +5,7 @@ describe "Scoped admins", type: :system do let(:organization) { create(:organization) } - let(:user) { create(:user, :confirmed, organization: organization) } + let(:user) { create(:user, :confirmed, :admin_terms_accepted, organization: organization) } let!(:participatory_process) { create :participatory_process, participatory_process_group: participatory_process_group, organization: organization } let!(:another_participatory_process) { create :participatory_process, organization: organization } @@ -49,27 +49,27 @@ end it "has access to managers module" do - visit catcomu_managers_admin.scoped_admins_path + visit decidim_catcomu_managers_admin.scoped_admins_path expect(page).to have_content("Participative processes in this group") end it "can edit the group" do - visit catcomu_managers_admin.scoped_admins_path + visit decidim_catcomu_managers_admin.scoped_admins_path click_link "Edit this group" expect(page).to have_content("Edit process group") end it "does not show other processes" do - visit catcomu_managers_admin.scoped_admins_path + visit decidim_catcomu_managers_admin.scoped_admins_path expect(page).to have_content(participatory_process.title["en"]) expect(page).not_to have_content(another_participatory_process.title["en"]) end it "can edit the processes" do - visit catcomu_managers_admin.scoped_admins_path + visit decidim_catcomu_managers_admin.scoped_admins_path click_link href: "/admin/participatory_processes/#{participatory_process.slug}/edit" expect(page).to have_content("General Information") @@ -85,7 +85,7 @@ end it "cannot change the group of the process" do - visit catcomu_managers_admin.scoped_admins_path + visit decidim_catcomu_managers_admin.scoped_admins_path click_link href: "/admin/participatory_processes/#{participatory_process.slug}/edit" fill_in_i18n( @@ -102,7 +102,7 @@ let(:user) { create(:user, :admin, :confirmed, organization: organization) } it "can change the group of the process" do - visit catcomu_managers_admin.scoped_admins_path + visit decidim_catcomu_managers_admin.scoped_admins_path click_link href: "/admin/participatory_processes/#{participatory_process.slug}/edit" fill_in_i18n( @@ -128,7 +128,7 @@ end it "has not actions in managers module" do - visit catcomu_managers_admin.scoped_admins_path + visit decidim_catcomu_managers_admin.scoped_admins_path expect(page).to have_content("Sorry, your user is not scoped into a group of processes!") expect(page).not_to have_content(participatory_process.title["en"])