diff --git a/config/locales/en.yml b/config/locales/en.yml
index a246f1d2ead..d9ceffa354c 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1003,7 +1003,7 @@ en:
hour_html:
one: "%{count} hour"
other: "%{count} hours"
- updated: "changed from %{first} to %{last}"
+ updated: "changed from %{old_value} to %{value}"
logged_for: "Logged for"
filter:
changeset: "Changesets"
diff --git a/lib/open_project/journal_formatter/time_entry_hours.rb b/lib/open_project/journal_formatter/time_entry_hours.rb
index 0739185748b..7e2672783cf 100644
--- a/lib/open_project/journal_formatter/time_entry_hours.rb
+++ b/lib/open_project/journal_formatter/time_entry_hours.rb
@@ -43,19 +43,19 @@ class OpenProject::JournalFormatter::TimeEntryHours < JournalFormatter::Base
(val % 1).zero? ? val.to_i : val
end
- def value(html, first, last)
+ def value(html, old_value, value)
html = html ? '_html' : ''
- first = format_float(first) if first
- last = format_float(last)
+ old_value = format_float(old_value) if old_value
+ value = format_float(value)
- if first
+ if old_value
I18n.t(:'activity.item.time_entry.updated',
- first: I18n.t(:"activity.item.time_entry.hour#{html}", count: first),
- last: I18n.t(:"activity.item.time_entry.hour#{html}", count: last))
+ old_value: I18n.t(:"activity.item.time_entry.hour#{html}", count: old_value),
+ value: I18n.t(:"activity.item.time_entry.hour#{html}", count: value))
else
I18n.t(:"activity.item.time_entry.hour#{html}",
- count: last)
+ count: value)
end
end
end
diff --git a/spec/components/activities/item_component_spec.rb b/spec/components/activities/item_component_spec.rb
index a0fc0e77ca3..2b1c1a89209 100644
--- a/spec/components/activities/item_component_spec.rb
+++ b/spec/components/activities/item_component_spec.rb
@@ -122,7 +122,7 @@ RSpec.describe Activities::ItemComponent, type: :component do
end
end
- context 'for TimeEntry activites' do
+ context 'for TimeEntry activities' do
let(:journal) { build_stubbed(:time_entry_journal) }
let(:event) do
Activities::Event.new(
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index cdbd5b5f79c..6ec16088112 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -6,19 +6,18 @@ require 'rack_session_access/capybara'
require 'action_dispatch'
RSpec.shared_context 'with default_url_options and host name set to Capybara test server' do
- before do
- @original_host = default_url_options[:host]
- @original_port = default_url_options[:port]
- @original_host_setting = Setting.host_name
- Setting.host_name = "#{Capybara.server_host}:#{Capybara.server_port}"
+ around do |example|
+ original_host = default_url_options[:host]
+ original_port = default_url_options[:port]
+ original_host_setting = Setting.host_name
default_url_options[:host] = Capybara.server_host
default_url_options[:port] = Capybara.server_port
- end
-
- after do
- default_url_options[:host] = @original_host # rubocop:disable RSpec/InstanceVariable
- default_url_options[:port] = @original_port # rubocop:disable RSpec/InstanceVariable
- Setting.host_name = @original_host_setting # rubocop:disable RSpec/InstanceVariable
+ Setting.host_name = "#{Capybara.server_host}:#{Capybara.server_port}"
+ example.run
+ ensure
+ default_url_options[:host] = original_host
+ default_url_options[:port] = original_port
+ Setting.host_name = original_host_setting
end
end