fix specs

This commit is contained in:
Klaus Zanders
2025-02-13 12:54:46 +01:00
parent cbcd06df94
commit 0e734a25fd
7 changed files with 39 additions and 34 deletions
@@ -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">
@@ -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
@@ -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"
@@ -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)
@@ -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
@@ -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",
expect(put("/admin/cost_types/5/set_rate")).to route_to(controller: "admin/cost_types",
action: "set_rate",
id: "5")
}
it {
expect(delete("/admin/cost_types/5")).to route_to(controller: "admin/cost_types",
action: "destroy",
id: "5")
}
it {
expect(delete("/cost_types/5")).to route_to(controller: "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
+3 -1
View File
@@ -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))