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
adapt hourly rates spec
ulferts684b56473042
diff --git a/modules/costs/app/views/cost_types/_rate.html.erb b/modules/costs/app/views/cost_types/_rate.html.erbindex 584edba1718..ee1078b7eaa 100644--- a/modules/costs/app/views/cost_types/_rate.html.erb+++ b/modules/costs/app/views/cost_types/_rate.html.erb@@ -34,7 +34,6 @@ See COPYRIGHT and LICENSE files for more details.id_or_index = rate.new_record? ? index : rate.idprefix = "cost_type[#{new_or_existing}_rate_attributes][]"id_prefix = "cost_type_#{new_or_existing}_rate_attributes_#{id_or_index}"- name_prefix = "cost_type[#{new_or_existing}_rate_attributes][#{id_or_index}]"classes ||= ""classes += " subform-row-template" if templated@@ -52,6 +51,7 @@ See COPYRIGHT and LICENSE files for more details.<label class="hidden-for-sighted" for="<%= "#{id_prefix}_valid_from" %>"><%= Rate.human_attribute_name(:valid_from) %></label><%= rate_form.date_picker :valid_from,class: 'date costs-date-picker',+ no_field_container: true,no_label: true,required: templated ? false : true %></td>@@ -65,6 +65,7 @@ See COPYRIGHT and LICENSE files for more details.placeholder: t(:label_example_placeholder, decimal: unitless_currency_number(1000.50)),value: rate.rate ? rate.rate.round(2) : "",no_label: true,+ no_field_container: true,required: templated ? false : true %><span class="form-label"><%= Setting.plugin_costs['costs_currency'] %>diff --git a/modules/costs/app/views/cost_types/edit.html.erb b/modules/costs/app/views/cost_types/edit.html.erbindex 798b040fbee..435fe43a3cf 100644--- a/modules/costs/app/views/cost_types/edit.html.erb+++ b/modules/costs/app/views/cost_types/edit.html.erb@@ -89,7 +89,7 @@ See COPYRIGHT and LICENSE files for more details.</tr></thead><tbody id="rates_body" class="subform-container">- <%= render partial: "rate", object: CostRate.new, locals: { templated: true } %>+ <%= render partial: "rate", object: CostRate.new(valid_from: Date.current), locals: { templated: true } %><% @cost_type.rates.sort do |a,b|casewhen !a.valid? && !b.valid?diff --git a/modules/costs/app/views/hourly_rates/_list_project.html.erb b/modules/costs/app/views/hourly_rates/_list_project.html.erbindex ca9adb9a1cb..bc6431ab431 100644--- a/modules/costs/app/views/hourly_rates/_list_project.html.erb+++ b/modules/costs/app/views/hourly_rates/_list_project.html.erb@@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.current_rate = if @all_ratesat_date_in_project_with_ancestors(Date.today, all_rates, project)else- current_rate = @user.current_rate(project)+ @user.current_rate(project)end%><div class="user-rate-history-list">diff --git a/modules/costs/app/views/hourly_rates/_rate.html.erb b/modules/costs/app/views/hourly_rates/_rate.html.erbindex ac1630cfc24..02b0f4fcb12 100644--- a/modules/costs/app/views/hourly_rates/_rate.html.erb+++ b/modules/costs/app/views/hourly_rates/_rate.html.erb@@ -34,7 +34,6 @@ See COPYRIGHT and LICENSE files for more details.id_or_index = rate.new_record? ? index : rate.idprefix = "user[#{new_or_existing}_rate_attributes][]"id_prefix = "user_#{new_or_existing}_rate_attributes_#{id_or_index}"- name_prefix = "user[#{new_or_existing}_rate_attributes][#{id_or_index}]"classes ||= ""classes += " subform-row-template" if templated-%>diff --git a/modules/costs/app/views/hourly_rates/edit.html.erb b/modules/costs/app/views/hourly_rates/edit.html.erbindex 28b826bb3c5..f5478fe9f2b 100644--- a/modules/costs/app/views/hourly_rates/edit.html.erb+++ b/modules/costs/app/views/hourly_rates/edit.html.erb@@ -76,7 +76,7 @@ See COPYRIGHT and LICENSE files for more details.</tr></thead><tbody id="rates_body" class="subform-container">- <%= render partial: "hourly_rates/rate", object: HourlyRate.new, locals: { templated: true } %>+ <%= render partial: "hourly_rates/rate", object: HourlyRate.new(valid_from: Date.current), locals: { templated: true } %><%- @rates.each_with_index do |rate, index| -%><%= render partial: 'rate', object: rate, locals: {index: index} %><%- end -%>diff --git a/modules/costs/spec/features/members_hourly_rates_spec.rb b/modules/costs/spec/features/members_hourly_rates_spec.rbindex 3b9602d5eaf..ba8767c39d3 100644--- a/modules/costs/spec/features/members_hourly_rates_spec.rb+++ b/modules/costs/spec/features/members_hourly_rates_spec.rb@@ -50,15 +50,18 @@ describe 'hourly rates on a member', js: true doexpect(page).to have_selector("#member-#{member.id} .currency", text: amount)end- def add_rate(rate:, date: nil)+ def add_rate(rate:, date:)expect(page).to have_selector(".add-row-button")sleep(0.1)all("tr[id^='user_new_rate_attributes_'] .delete-row-button").each(&:click)sleep(0.1)click_link_or_button 'Add rate'+ datepicker = Components::Datepicker.new+ datepicker.set_date(date)+ datepicker.save!+within "tr[id^='user_new_rate_attributes_']" do- fill_in 'Valid from', with: date.strftime('%Y-%m-%d') if datefill_in 'Rate', with: rateendend@@ -80,7 +83,7 @@ describe 'hourly rates on a member', js: true doclick_link('0.00 EUR')SeleniumHubWaiter.wait- add_rate(date: Date.today, rate: 10)+ add_rate(date: Date.current, rate: 10)click_button 'Save'@@ -98,7 +101,7 @@ describe 'hourly rates on a member', js: true doSeleniumHubWaiter.waitclick_link('10.00 EUR')- change_rate_date(from: Date.today, to: 5.days.ago)+ change_rate_date(from: Date.current, to: 5.days.ago)click_button 'Save'diff --git a/modules/meeting/spec/support/pages/meetings/new.rb b/modules/meeting/spec/support/pages/meetings/new.rbindex d11dbfb73a7..3ee3174ea14 100644--- a/modules/meeting/spec/support/pages/meetings/new.rb+++ b/modules/meeting/spec/support/pages/meetings/new.rb@@ -47,13 +47,10 @@ module Pages::Meetingsfill_in 'Title', with: textend- def set_start_date(date_string)- datepicker = Components::Datepicker.new+ def set_start_date(date)find_by_id('meeting_start_date').click- date = Date.parse(date_string)- datepicker.select_year(date.year)- datepicker.select_month(I18n.t("date.month_names")[date.month])- datepicker.select_day(date.day)+ datepicker = Components::Datepicker.new+ datepicker.set_date(date)datepicker.save!end