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
[#53620] fixed failing tests
Eric Schubert820c4abbcc0e
diff --git a/app/components/oauth/applications/application_row_component.html.erb b/app/components/oauth/applications/application_row_component.html.erbindex 5813d4cd4aa..0a7e9787336 100644--- a/app/components/oauth/applications/application_row_component.html.erb+++ b/app/components/oauth/applications/application_row_component.html.erb@@ -1,5 +1,5 @@<%=- component_wrapper do+ component_wrapper(data: { 'test-selector': "op-admin-oauth--application" }) doflex_layout(align_items: :center, justify_content: :space_between) do |oauth_application_container|oauth_application_container.with_column(flex_layout: true) do |application_information|application_information.with_column(mr: 2) do@@ -32,7 +32,10 @@render(Primer::Alpha::ToggleSwitch.new(src: toggle_oauth_application_path(@application),csrf_token: form_authenticity_token,- checked: @application.enabled?+ checked: @application.enabled?,+ data: {+ 'test-selector': "op-admin-oauth--application-enabled-toggle-switch"+ }))endenddiff --git a/app/components/oauth/applications/index_component.html.erb b/app/components/oauth/applications/index_component.html.erbindex 020862cae06..856ff7b0b13 100644--- a/app/components/oauth/applications/index_component.html.erb+++ b/app/components/oauth/applications/index_component.html.erb@@ -2,7 +2,9 @@component_wrapper doflex_layout do |index_container|index_container.with_row do- render(border_box_container(mb: 4)) do |component|+ render(border_box_container(mb: 4, data: {+ 'test-selector': "op-admin-oauth--built-in-applications"+ })) do |component|component.with_header(font_weight: :bold) dorender(Primer::Beta::Text.new) dot("oauth.header.builtin_applications")@@ -11,7 +13,9 @@if @built_in_applications.empty?component.with_row do- render(Primer::Beta::Text.new) do+ render(Primer::Beta::Text.new(data: {+ 'test-selector': "op-admin-oauth--built-in-applications-placeholder"+ })) dot("oauth.empty_application_lists")endend@@ -33,7 +37,7 @@if @other_applications.empty?component.with_row do- render(Primer::Beta::Text.new) do+ render(Primer::Beta::Text.new(data: { 'test-selector': "op-admin-oauth--applications-placeholder" })) dot("oauth.empty_application_lists")endenddiff --git a/app/contracts/concerns/requires_admin_guard.rb b/app/contracts/concerns/requires_admin_guard.rbindex c4950a78307..133ac24d0bb 100644--- a/app/contracts/concerns/requires_admin_guard.rb+++ b/app/contracts/concerns/requires_admin_guard.rb@@ -35,7 +35,7 @@ module RequiresAdminGuard# Adds an error if user is archived or not an admin.def validate_admin_only- unless user.active_admin?+ unless user.admin? && user.active?errors.add :base, :error_unauthorizedendenddiff --git a/app/contracts/delete_contract.rb b/app/contracts/delete_contract.rbindex 6deff838010..d8f06edc14e 100644--- a/app/contracts/delete_contract.rb+++ b/app/contracts/delete_contract.rb@@ -56,7 +56,7 @@ class DeleteContract < ModelContractcase permissionwhen :admin- user.active_admin?+ user.admin? && user.active?when Procinstance_exec(&permission)when Symboldiff --git a/app/contracts/oauth_clients/create_contract.rb b/app/contracts/oauth_clients/create_contract.rbindex f8f439372b5..404436c4a1a 100644--- a/app/contracts/oauth_clients/create_contract.rb+++ b/app/contracts/oauth_clients/create_contract.rb@@ -47,7 +47,7 @@ module OAuthClientsprivatedef validate_user_allowed- unless user.active_admin?+ unless user.admin? && user.active?errors.add :base, :error_unauthorizedendenddiff --git a/modules/bim/spec/features/bcf/api_authorization_spec.rb b/modules/bim/spec/features/bcf/api_authorization_spec.rbindex c02100f6158..5ae2fc055fe 100644--- a/modules/bim/spec/features/bcf/api_authorization_spec.rb+++ b/modules/bim/spec/features/bcf/api_authorization_spec.rb@@ -46,7 +46,7 @@ RSpec.describe "authorization for BCF api", :js, with_config: { edition: "bim" }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_css(".generic-table--empty-row", text: "There is currently nothing to display")+ expect(page).to have_test_selector("op-admin-oauth--applications-placeholder")# Create applicationpage.find_test_selector("op-admin-oauth--button-new", text: "OAuth application").clickdiff --git a/modules/storages/app/contracts/storages/storages/concerns/manage_storages_guarded.rb b/modules/storages/app/contracts/storages/storages/concerns/manage_storages_guarded.rbindex 010ba0ab249..34e85ad8d39 100644--- a/modules/storages/app/contracts/storages/storages/concerns/manage_storages_guarded.rb+++ b/modules/storages/app/contracts/storages/storages/concerns/manage_storages_guarded.rb@@ -52,7 +52,7 @@ module Storages::Storages# Small procedure to check that the current user is admin and activedef validate_user_allowed_to_manage- unless user.active_admin?+ unless user.admin? && user.active?errors.add :base, :error_unauthorizedendenddiff --git a/spec/features/admin/oauth/oauth_applications_management_spec.rb b/spec/features/admin/oauth/oauth_applications_management_spec.rbindex 149c750943c..faaab28a488 100644--- a/spec/features/admin/oauth/oauth_applications_management_spec.rb+++ b/spec/features/admin/oauth/oauth_applications_management_spec.rb@@ -39,7 +39,7 @@ RSpec.describe "OAuth applications management", :js, :with_cuprite dovisit oauth_applications_path# Initially empty- expect(page).to have_css(".generic-table--empty-row", text: "There is currently nothing to display")+ expect(page).to have_test_selector("op-admin-oauth--applications-placeholder")# Create applicationpage.find_test_selector("op-admin-oauth--button-new", text: "OAuth application").click@@ -52,7 +52,7 @@ RSpec.describe "OAuth applications management", :js, :with_cuprite doexpect(page).to have_css(".errorExplanation", text: "Redirect URI must be an absolute URI.")fill_in("application_redirect_uri", with: "")- # Fill rediret_uri which does not provide a Secure Context+ # Fill redirect_uri which does not provide a Secure Contextfill_in "application_redirect_uri", with: "http://example.org"click_on "Create"@@ -78,7 +78,7 @@ RSpec.describe "OAuth applications management", :js, :with_cuprite doclick_on "Save"# Show application- find("td a", text: "My API application").click+ click_on "My API application"expect(page).to have_no_css(".attributes-key-value--key", text: "Client secret")expect(page).to have_no_css(".attributes-key-value--value code")@@ -90,7 +90,7 @@ RSpec.describe "OAuth applications management", :js, :with_cuprite doend# Table is empty again- expect(page).to have_css(".generic-table--empty-row", text: "There is currently nothing to display")+ expect(page).to have_test_selector("op-admin-oauth--applications-placeholder")endcontext "with a seeded application" do@@ -101,32 +101,34 @@ RSpec.describe "OAuth applications management", :js, :with_cuprite doit "does not allow editing or deleting the seeded application" dovisit oauth_applications_path- expect(page).to have_css("td.name", text: "OpenProject Mobile App")- expect(page).to have_css("td.builtin .icon-checkmark")- expect(page).to have_css("td.enabled .icon-checkmark")+ app = Doorkeeper::Application.last- expect(page).to have_no_css("td.buttons", text: "Edit")- expect(page).to have_no_css("td.buttons", text: "Delete")+ within_test_selector("op-admin-oauth--built-in-applications") do+ expect(page).to have_test_selector("op-admin-oauth--application", count: 1)+ expect(page).to have_link(text: "OpenProject Mobile App")+ expect(page).to have_test_selector("op-admin-oauth--application-enabled-toggle-switch", text: "On")- expect(page).to have_css("td.buttons", text: "Deactivate")- click_link_or_button "Deactivate"+ find_test_selector("op-admin-oauth--application-enabled-toggle-switch").click+ expect(page).not_to have_test_selector("op-admin-oauth--application-enabled-toggle-switch", text: "Loading")+ expect(page).to have_test_selector("op-admin-oauth--application-enabled-toggle-switch", text: "Off")- expect(page).to have_css("td.builtin .icon-checkmark")- expect(page).to have_no_css("td.enabled .icon-checkmark")+ app.reload+ expect(app).to be_builtin+ expect(app).not_to be_enabled- app = Doorkeeper::Application.last- expect(app).to be_builtin- expect(app).not_to be_enabled+ find_test_selector("op-admin-oauth--application-enabled-toggle-switch").click+ expect(page).not_to have_test_selector("op-admin-oauth--application-enabled-toggle-switch", text: "Loading")+ expect(page).to have_test_selector("op-admin-oauth--application-enabled-toggle-switch", text: "On")- expect(page).to have_css("td.buttons", text: "Activate")- click_link_or_button "Activate"+ app.reload+ expect(app).to be_builtin+ expect(app).to be_enabled- expect(page).to have_css("td.builtin .icon-checkmark")- expect(page).to have_css("td.enabled .icon-checkmark")+ click_on "OpenProject Mobile App"+ end- app.reload- expect(app).to be_builtin- expect(app).to be_enabled+ expect(page).to have_no_button("Edit")+ expect(page).to have_no_button("Delete")visit edit_oauth_application_path(app)expect(page).to have_text "You are not authorized to access this page."