Fix some review issues such as naming and typos

This commit is contained in:
Mir Bhatia
2023-05-15 09:43:18 +02:00
parent 72408fc609
commit 5acc40eef6
4 changed files with 19 additions and 20 deletions
+1 -1
View File
@@ -1003,7 +1003,7 @@ en:
hour_html:
one: "<i>%{count} hour</i>"
other: "<i>%{count} hours</i>"
updated: "changed from %{first} to %{last}"
updated: "changed from %{old_value} to %{value}"
logged_for: "Logged for"
filter:
changeset: "Changesets"
@@ -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
@@ -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(
+10 -11
View File
@@ -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