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 implicit hashes being passed as args to `JSON.dump`
Klaus Zanders97e00336433d
diff --git a/modules/backlogs/spec/features/work_packages/remaining_time_spec.rb b/modules/backlogs/spec/features/work_packages/remaining_time_spec.rbindex 743d8aab8fd..b10d9daeaef 100644--- a/modules/backlogs/spec/features/work_packages/remaining_time_spec.rb+++ b/modules/backlogs/spec/features/work_packages/remaining_time_spec.rb@@ -74,8 +74,10 @@ RSpec.describe 'Work packages remaining time', :js, :with_cuprite dowork_packagewp_table_page = Pages::WorkPackagesTable.new(project)- query_props = JSON.dump(c: %w(id subject remainingTime),- s: true)+ query_props = JSON.dump({+ c: %w(id subject remainingTime),+ s: true+ })wp_table_page.visit_with_params("query_props=#{query_props}")diff --git a/modules/bim/spec/features/bcf/api_authorization_spec.rb b/modules/bim/spec/features/bcf/api_authorization_spec.rbindex 5833c1a6cad..8561414d50c 100644--- a/modules/bim/spec/features/bcf/api_authorization_spec.rb+++ b/modules/bim/spec/features/bcf/api_authorization_spec.rb@@ -28,8 +28,7 @@require 'spec_helper'-RSpec.describe 'authorization for BCF api',- js: true, with_config: { edition: 'bim' } do+RSpec.describe 'authorization for BCF api', :js, with_config: { edition: 'bim' } dolet!(:user) { create(:admin) }let(:client_secret) { app.plaintext_secret }let(:scope) { 'bcf_v2_1' }@@ -47,7 +46,7 @@ RSpec.describe 'authorization for BCF api',it 'can create and later authorize and manage an OAuth application grant and then use the access token for the bcf api' do# Initially empty- expect(page).to have_selector('.generic-table--empty-row', text: 'There is currently nothing to display')+ expect(page).to have_css('.generic-table--empty-row', text: 'There is currently nothing to display')# Create applicationfind('.button', text: 'Add').click@@ -58,19 +57,19 @@ RSpec.describe 'authorization for BCF api',fill_in 'application_redirect_uri', with: "not a url!"click_on 'Create'- expect(page).to have_selector('.errorExplanation', text: 'Redirect URI must be an absolute URI.')+ expect(page).to have_css('.errorExplanation', text: 'Redirect URI must be an absolute URI.')fill_in 'application_redirect_uri', with: "urn:ietf:wg:oauth:2.0:oob\nhttps://localhost/my/callback"click_on 'Create'- expect(page).to have_selector('.op-toast.-success', text: 'Successful creation.')+ expect(page).to have_css('.op-toast.-success', text: 'Successful creation.')- expect(page).to have_selector('.attributes-key-value--key',- text: 'Client ID')- expect(page).to have_selector('.attributes-key-value--value',- text: "urn:ietf:wg:oauth:2.0:oob\nhttps://localhost/my/callback")+ expect(page).to have_css('.attributes-key-value--key',+ text: 'Client ID')+ expect(page).to have_css('.attributes-key-value--value',+ text: "urn:ietf:wg:oauth:2.0:oob\nhttps://localhost/my/callback")# Should print secret on initial visit- expect(page).to have_selector('.attributes-key-value--key', text: 'Client secret')+ expect(page).to have_css('.attributes-key-value--key', text: 'Client secret')client_secret = page.first('.attributes-key-value--value code').textexpect(client_secret).to match /\w+/@@ -79,11 +78,11 @@ RSpec.describe 'authorization for BCF api',visit oauth_path app.uid# We get to the authorization screen- expect(page).to have_selector('h2', text: 'Authorize My API application')+ expect(page).to have_css('h2', text: 'Authorize My API application')# With the correct scope printed- expect(page).to have_selector('li strong', text: I18n.t('oauth.scopes.bcf_v2_1'))- expect(page).to have_selector('li', text: I18n.t('oauth.scopes.bcf_v2_1_text'))+ expect(page).to have_css('li strong', text: I18n.t('oauth.scopes.bcf_v2_1'))+ expect(page).to have_css('li', text: I18n.t('oauth.scopes.bcf_v2_1_text'))# Authorizefind('input.button[value="Authorize"]').click@@ -120,19 +119,19 @@ RSpec.describe 'authorization for BCF api',click_on 'Access token'expect(page).to have_selector("#oauth-application-grant-#{app.id}", text: app.name)- expect(page).to have_selector('td', text: app.name)+ expect(page).to have_css('td', text: app.name)# While being logged in, the api can be accessed with the sessionvisit("/api/bcf/2.1/projects/#{project.id}")expect(page)- .to have_content(JSON.dump(project_id: project.id, name: project.name))+ .to have_content(JSON.dump({ project_id: project.id, name: project.name }))logout# While not being logged in and without a token, the api cannot be accessedvisit("/api/bcf/2.1/projects/#{project.id}")expect(page)- .to have_content(JSON.dump(message: "You need to be authenticated to access this resource."))+ .to have_content(JSON.dump({ message: "You need to be authenticated to access this resource." }))## Without the access token, access is deniedapi_session = ActionDispatch::Integration::Session.new(Rails.application)diff --git a/spec/features/work_packages/table/invalid_query_spec.rb b/spec/features/work_packages/table/invalid_query_spec.rbindex 937520b4e6e..c95955c7a3e 100644--- a/spec/features/work_packages/table/invalid_query_spec.rb+++ b/spec/features/work_packages/table/invalid_query_spec.rb@@ -1,6 +1,6 @@require 'spec_helper'-RSpec.describe 'Invalid query spec', js: true do+RSpec.describe 'Invalid query spec', :js dolet(:user) { create(:admin) }let(:project) { create(:project) }@@ -80,10 +80,10 @@ RSpec.describe 'Invalid query spec', js: true dofilter_props = [{ n: 'assignee', o: '=', v: ['999999'] },{ n: 'status', o: '=', v: [status.id.to_s, status2.id.to_s] }]column_props = %w(id subject customField0815)- invalid_props = JSON.dump(f: filter_props,- c: column_props,- g: 'customField0815',- t: 'customField0815:desc')+ invalid_props = JSON.dump({ f: filter_props,+ c: column_props,+ g: 'customField0815',+ t: 'customField0815:desc' })wp_table.visit_with_params("query_id=#{valid_query.id}&query_props=#{invalid_props}")