Skip to content

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

fix specs

Klaus Zanders0e734a25fdaa
diff --git a/modules/costs/app/views/admin/cost_types/index.html.erb b/modules/costs/app/views/admin/cost_types/index.html.erb
index b240dfb215e..d42a9fae344 100644
--- a/modules/costs/app/views/admin/cost_types/index.html.erb
+++ b/modules/costs/app/views/admin/cost_types/index.html.erb
@@ -55,7 +55,7 @@ See COPYRIGHT and LICENSE files for more details.
end %>
<% subheader.with_bottom_pane_component do %>
- <%= styled_form_tag(cost_types_path, { method: :get, id: "query_form" }) do %>
+ <%= styled_form_tag(admin_cost_types_path, { method: :get, id: "query_form" }) do %>
<fieldset id="filters" class="simple-filters--container">
<legend><%= t(:label_filter_plural) %></legend>
<ul class="simple-filters--filters">
diff --git a/modules/costs/spec/controllers/cost_types_controller_spec.rb b/modules/costs/spec/controllers/admin/cost_types_controller_spec.rb
similarity index 89%
rename from modules/costs/spec/controllers/cost_types_controller_spec.rb
rename to modules/costs/spec/controllers/admin/cost_types_controller_spec.rb
index 416c8219e62..1c5597049e4 100644
--- a/modules/costs/spec/controllers/cost_types_controller_spec.rb
+++ b/modules/costs/spec/controllers/admin/cost_types_controller_spec.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require File.expand_path(File.dirname(__FILE__) + "/../spec_helper.rb")
+require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper.rb")
-RSpec.describe CostTypesController do
+RSpec.describe Admin::CostTypesController do
let(:admin) { create(:admin) }
let(:cost_type) { create(:cost_type) }
@@ -39,7 +39,7 @@ RSpec.describe CostTypesController do
end
expect(assigns(:cost_type).deleted_at).to be_a Time
- expect(response).to redirect_to cost_types_path
+ expect(response).to redirect_to admin_cost_types_path
expect(flash[:notice]).to eq I18n.t(:notice_successful_lock)
end
end
@@ -55,7 +55,7 @@ RSpec.describe CostTypesController do
end
expect(assigns(:cost_type).deleted_at).to be_nil
- expect(response).to redirect_to cost_types_path
+ expect(response).to redirect_to admin_cost_types_path
expect(flash[:notice]).to eq I18n.t(:notice_successful_restore)
end
end
diff --git a/modules/costs/spec/features/cost_types/create_cost_type_spec.rb b/modules/costs/spec/features/cost_types/create_cost_type_spec.rb
index e8e8f708cd8..c01d8607550 100644
--- a/modules/costs/spec/features/cost_types/create_cost_type_spec.rb
+++ b/modules/costs/spec/features/cost_types/create_cost_type_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe "creating a cost type", :js do
end
it "can create a cost type" do
- visit "/cost_types/new"
+ visit "/admin/cost_types/new"
fill_in "cost_type_name", with: "Test day rate"
fill_in "cost_type_unit", with: "dayUnit"
@@ -72,7 +72,7 @@ RSpec.describe "creating a cost type", :js do
let(:user) { create(:admin, language: :de) }
it "creates the entry with german number separators" do
- visit "/cost_types/new"
+ visit "/admin/cost_types/new"
fill_in "cost_type_name", with: "Test day rate"
fill_in "cost_type_unit", with: "dayUnit"
diff --git a/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb b/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb
index 95980135f8c..ca201b229aa 100644
--- a/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb
+++ b/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe "deleting a cost type", :js do
end
it "can delete the cost type" do
- visit cost_types_path
+ visit admin_cost_types_path
within("#delete_cost_type_#{cost_type.id}") do
scroll_to_and_click(find("button.submit_cost_type"))
@@ -51,11 +51,12 @@ RSpec.describe "deleting a cost type", :js do
expect_angular_frontend_initialized
expect(page).to have_css ".generic-table--no-results-container", wait: 10
- SeleniumHubWaiter.wait
# Show locked
find_by_id("include_deleted").set true
click_on "Apply"
+ wait_for_network_idle
+
# Expect no results if not locked
expect(page).to have_text I18n.t(:label_locked_cost_types)
diff --git a/modules/costs/spec/features/time_entry/activity_spec.rb b/modules/costs/spec/features/time_entry/activity_spec.rb
index 14f577754b8..fb9a3d88a12 100644
--- a/modules/costs/spec/features/time_entry/activity_spec.rb
+++ b/modules/costs/spec/features/time_entry/activity_spec.rb
@@ -37,6 +37,8 @@ RSpec.describe "Time entry activity" do
end
it "supports CRUD" do
+ pending "this is currently isaled as we move to their own page"
+
visit enumerations_path
page.find_test_selector("create-enumeration-time-entry-activity").click
diff --git a/modules/costs/spec/routing/cost_types_routing_spec.rb b/modules/costs/spec/routing/cost_types_routing_spec.rb
index 1d156e09964..02e1178625d 100644
--- a/modules/costs/spec/routing/cost_types_routing_spec.rb
+++ b/modules/costs/spec/routing/cost_types_routing_spec.rb
@@ -28,51 +28,51 @@
require "spec_helper"
-RSpec.describe CostTypesController do
+RSpec.describe Admin::CostTypesController do
describe "routing" do
it {
- expect(get("/cost_types")).to route_to(controller: "cost_types",
- action: "index")
+ expect(get("/admin/cost_types")).to route_to(controller: "admin/cost_types",
+ action: "index")
}
it {
- expect(post("/cost_types")).to route_to(controller: "cost_types",
- action: "create")
+ expect(post("/admin/cost_types")).to route_to(controller: "admin/cost_types",
+ action: "create")
}
it {
- expect(get("/cost_types/new")).to route_to(controller: "cost_types",
- action: "new")
+ expect(get("/admin/cost_types/new")).to route_to(controller: "admin/cost_types",
+ action: "new")
}
it {
- expect(get("/cost_types/5/edit")).to route_to(controller: "cost_types",
- action: "edit",
- id: "5")
+ expect(get("/admin/cost_types/5/edit")).to route_to(controller: "admin/cost_types",
+ action: "edit",
+ id: "5")
}
it {
- expect(put("/cost_types/5")).to route_to(controller: "cost_types",
- action: "update",
- id: "5")
+ expect(put("/admin/cost_types/5")).to route_to(controller: "admin/cost_types",
+ action: "update",
+ id: "5")
}
it {
- expect(put("/cost_types/5/set_rate")).to route_to(controller: "cost_types",
- action: "set_rate",
- id: "5")
+ expect(put("/admin/cost_types/5/set_rate")).to route_to(controller: "admin/cost_types",
+ action: "set_rate",
+ id: "5")
}
it {
- expect(delete("/cost_types/5")).to route_to(controller: "cost_types",
- action: "destroy",
- id: "5")
+ expect(delete("/admin/cost_types/5")).to route_to(controller: "admin/cost_types",
+ action: "destroy",
+ id: "5")
}
it {
- expect(patch("/cost_types/5/restore")).to route_to(controller: "cost_types",
- action: "restore",
- id: "5")
+ expect(patch("/admin/cost_types/5/restore")).to route_to(controller: "admin/cost_types",
+ action: "restore",
+ id: "5")
}
end
end
diff --git a/spec/features/admin/enumerations_spec.rb b/spec/features/admin/enumerations_spec.rb
index 1a6ee6925e4..d0b568c6cc4 100644
--- a/spec/features/admin/enumerations_spec.rb
+++ b/spec/features/admin/enumerations_spec.rb
@@ -37,7 +37,9 @@ RSpec.describe "Enumerations" do
end
it "contains all defined enumerations" do
- Enumeration.subclasses.each do |enumeration|
+ classes = Enumeration.subclasses - [TimeEntryActivity]
+
+ classes.each do |enumeration|
expect(page).to have_css("h3", text: I18n.t(enumeration::OptionName))
expect(page).to have_link(I18n.t(:label_enumeration_new),
href: new_enumeration_path(type: enumeration.name))