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
Add spec for invalid token version
Oliver Günther02a98e038dc3
diff --git a/spec/features/admin/enterprise/enterprise_trial_spec.rb b/spec/features/admin/enterprise/enterprise_trial_spec.rbindex e6d21640309..bce492b15bc 100644--- a/spec/features/admin/enterprise/enterprise_trial_spec.rb+++ b/spec/features/admin/enterprise/enterprise_trial_spec.rb@@ -148,6 +148,19 @@ describe 'Enterprise trial management',}end+ let(:other_error_body) do+ {+ _type: "error",+ code: 409,+ description: "Token version is invalid",+ identifier: "token_version_too_old",+ errors: {+ token_version: [+ "does not have a valid value"+ ]+ }+ }+ endbefore dologin_as(admin)@@ -165,7 +178,7 @@ describe 'Enterprise trial management',it 'blocks the request assuming the mail was used' doproxy.stub('https://augur.openproject-edge.com:443/public/v1/trials', method: 'post')- .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 422, body: mail_in_use_body.to_json)+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 422, body: mail_in_use_body.to_json)find('.button', text: 'Start free trial').clickfill_out_modal@@ -178,7 +191,7 @@ describe 'Enterprise trial management',it 'blocks the request assuming the domain was used' doproxy.stub('https://augur.openproject-edge.com:443/public/v1/trials', method: 'post')- .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 422, body: domain_in_use_body.to_json)+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 422, body: domain_in_use_body.to_json)find('.button', text: 'Start free trial').clickfill_out_modal@@ -189,16 +202,28 @@ describe 'Enterprise trial management',expect(page).to have_no_text 'email sent - waiting for confirmation'end+ it 'shows an error in case of other errors' do+ proxy.stub('https://augur.openproject-edge.com:443/public/v1/trials', method: 'post')+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 409, body: other_error_body.to_json)++ find('.button', text: 'Start free trial').click+ fill_out_modal+ find('.button:not(:disabled)', text: 'Submit').click++ expect(page).to have_text('Token version is invalid')+ expect(page).to have_no_text 'email sent - waiting for confirmation'+ end+context 'with a waiting request pending' dobefore doproxy.stub('https://augur.openproject-edge.com:443/public/v1/trials', method: 'post')- .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 200, body: created_body.to_json)+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 200, body: created_body.to_json)proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}")- .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 422, body: waiting_body.to_json)+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 422, body: waiting_body.to_json)proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}/resend", method: 'post')- .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 200, body: waiting_body.to_json)+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 200, body: waiting_body.to_json)find('.button', text: 'Start free trial').clickfill_out_modal@@ -216,11 +241,11 @@ describe 'Enterprise trial management',# Stub the proxy to a successful return# which marks the user has confirmed the mail linkproxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}")- .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 200, body: confirmed_body.to_json)+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 200, body: confirmed_body.to_json)# Stub the details URL to still return 403proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}/details")- .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 403)+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 403)visit enterprise_path@@ -242,7 +267,7 @@ describe 'Enterprise trial management',# Stub the proxy to a successful return# which marks the user has confirmed the mail linkproxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}")- .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 200, body: confirmed_body.to_json)+ .and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 200, body: confirmed_body.to_json)# Wait until the next requestexpect(page).to have_selector '.status--confirmed', text: 'confirmed', wait: 20