OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix tests.
Pavel Balashou0054a8673aa5
diff --git a/spec/controllers/members_controller_spec.rb b/spec/controllers/members_controller_spec.rbindex b9149e28b1d..81904bd628b 100644--- a/spec/controllers/members_controller_spec.rb+++ b/spec/controllers/members_controller_spec.rb@@ -39,18 +39,12 @@ RSpec.describe MembersController doroles: [role])end- before do- allow(User).to receive(:current).and_return(admin)- end+ before { login_as(admin) }describe 'create' doshared_let(:admin) { create(:admin) }let(:project_2) { create(:project) }- before do- allow(User).to receive(:current).and_return(admin)- end-it 'works for multiple users' dopost :create,params: {@@ -88,10 +82,6 @@ RSpec.describe MembersController do)end- before do- allow(User).to receive(:current).and_return(admin)- end-it 'however,s allow roles to be updated through mass assignment' doput 'update',params: {@@ -110,9 +100,7 @@ RSpec.describe MembersController dodescribe '#autocomplete_for_member' dolet(:params) { { 'project_id' => project.identifier.to_s } }- before do- login_as(user)- end+ before { login_as(user) }describe "WHEN the user is authorizedWHEN a project is provided" dodiff --git a/spec/features/auth/consent_auth_stage_spec.rb b/spec/features/auth/consent_auth_stage_spec.rbindex 8dd5eb4f60e..faa081cc51f 100644--- a/spec/features/auth/consent_auth_stage_spec.rb+++ b/spec/features/auth/consent_auth_stage_spec.rb@@ -100,18 +100,26 @@ RSpec.describe 'Authentication Stages' doconsent_required: true,consent_info: { de: '# Einwilligung', en: '# Consent header!' }} do- around do |example|- Capybara.current_session.driver.header('Accept-Language', 'de')- example.call- ensure- Capybara.current_session.driver.header('Accept-Language', 'en')+ context 'users language is en' do+ let(:language) { 'en' }++ it 'shows consent en' do+ login_with user.login, user_password++ expect(page).to have_css('.account-consent')+ expect(page).to have_css('h1', text: 'Consent header!')+ endend- it 'shows localized consent as defined by the accept language header (ignoring users language)' do- login_with user.login, user_password+ context 'users language is de' do+ let(:language) { 'de' }- expect(page).to have_css('.account-consent')- expect(page).to have_css('h1', text: 'Einwilligung')+ it 'shows consent in de' do+ login_with user.login, user_password++ expect(page).to have_css('.account-consent')+ expect(page).to have_css('h1', text: 'Einwilligung')+ endendenddiff --git a/spec/support/authentication_helpers.rb b/spec/support/authentication_helpers.rbindex 3c669bdb2e7..43ce2386c5d 100644--- a/spec/support/authentication_helpers.rb+++ b/spec/support/authentication_helpers.rb@@ -49,7 +49,8 @@ module AuthenticationHelpersendend- allow(User).to receive(:current).and_return(user)+ allow(RequestStore).to receive(:[]).and_call_original+ allow(RequestStore).to receive(:[]).with(:current_user).and_return(user)enddef login_with(login, password, autologin: false, visit_signin_path: true)