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

expand tests for non editing and custom budget case

ulferts8727e40b0e15
diff --git a/modules/costs/spec/features/budgets/update_budget_spec.rb b/modules/costs/spec/features/budgets/update_budget_spec.rb
index 3a4ac283586..a09057e1a52 100644
--- a/modules/costs/spec/features/budgets/update_budget_spec.rb
+++ b/modules/costs/spec/features/budgets/update_budget_spec.rb
@@ -78,13 +78,15 @@ describe 'updating a budget', type: :feature, js: true do
end
let(:material_budget_item) do
- FactoryBot.create :material_budget_item, units: 3,
+ FactoryBot.create :material_budget_item,
+ units: 3,
cost_type: cost_type,
cost_object: budget
end
let(:labor_budget_item) do
- FactoryBot.create :labor_budget_item, hours: 5,
+ FactoryBot.create :labor_budget_item,
+ hours: 5,
user: user,
cost_object: budget
end
@@ -135,12 +137,25 @@ describe 'updating a budget', type: :feature, js: true do
context 'with german locale' do
let(:user) { FactoryBot.create :admin, language: :de }
+ let(:cost_type2) do
+ FactoryBot.create :cost_type, name: 'ABC', unit: 'abc', unit_plural: 'abcs'
+ end
+
+ let(:material_budget_item2) do
+ FactoryBot.create :material_budget_item,
+ units: 3,
+ cost_type: cost_type2,
+ cost_object: budget,
+ budget: 1000.0
+ end
it 'retains the overridden budget when opening, but not editing (Regression #32822)' do
+ material_budget_item2
budget_page.visit!
click_on 'Bearbeiten'
budget_page.expect_planned_costs! type: :material, row: 1, expected: '150,00 EUR'
+ budget_page.expect_planned_costs! type: :material, row: 2, expected: '1.000,00 EUR'
budget_page.expect_planned_costs! type: :labor, row: 1, expected: '125,00 EUR'
# Open first item
@@ -151,6 +166,7 @@ describe 'updating a budget', type: :feature, js: true do
expect(budget_page).to have_content("Erfolgreich aktualisiert.")
expect(page).to have_selector('tbody td.currency', text: '150,00 EUR')
+ expect(page).to have_selector('tbody td.currency', text: '1.000,00 EUR')
expect(page).to have_selector('tbody td.currency', text: '125,00 EUR')
end
end
@@ -193,7 +209,6 @@ describe 'updating a budget', type: :feature, js: true do
end
context 'with a reversed currency format' do
-
before do
allow(Setting)
.to receive(:plugin_openproject_costs)