aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/common_helper.rb8
-rw-r--r--app/views/imports/_import_messages.html.slim2
-rw-r--r--spec/helpers/common_helper_spec.rb39
-rw-r--r--spec/views/imports/show.html.slim_spec.rb5
4 files changed, 2 insertions, 52 deletions
diff --git a/app/helpers/common_helper.rb b/app/helpers/common_helper.rb
deleted file mode 100644
index b515f681b..000000000
--- a/app/helpers/common_helper.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-
-module CommonHelper
- def string_keys_to_symbols enumerable_pairs
- enumerable_pairs.inject({}){ | hashy, (k, v) |
- hashy.merge k.to_sym => v
- }
- end
-end
diff --git a/app/views/imports/_import_messages.html.slim b/app/views/imports/_import_messages.html.slim
index 9ab9226f7..4f2755b1d 100644
--- a/app/views/imports/_import_messages.html.slim
+++ b/app/views/imports/_import_messages.html.slim
@@ -7,4 +7,4 @@
dd.import_message
= t( ['import_messages',
'compliance_check_messages',
- import_message.message_key].join('.'), string_keys_to_symbols(import_message.message_attributes))
+ import_message.message_key].join('.'), import_message.message_attributes.symbolize_keys)
diff --git a/spec/helpers/common_helper_spec.rb b/spec/helpers/common_helper_spec.rb
deleted file mode 100644
index 1ffdc5bab..000000000
--- a/spec/helpers/common_helper_spec.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-RSpec.describe CommonHelper do
-
- subject do
- Object.new.extend( described_class )
- end
-
- describe 'string_keys_to_symbols' do
- context 'nullpotency on symbol keys' do
- it { expect(subject.string_keys_to_symbols({})).to eq({}) }
- it do
- expect(subject.string_keys_to_symbols(
- a: 1, b: 2
- )).to eq(a: 1, b: 2)
- end
- end
-
- context 'changing string keys' do
- it { expect(subject.string_keys_to_symbols('alpha' => 100)).to eq(alpha: 100) }
-
- it do
- expect( subject.string_keys_to_symbols('a' => 10, b: 20) )
- .to eq(a: 10, b: 20)
- end
- it do
- expect( subject.string_keys_to_symbols('a' => 10, 'b' => 20) )
- .to eq(a: 10, b: 20)
- end
- end
-
- context 'keys, not values, are changed' do
- it do
- expect(subject.string_keys_to_symbols(a: 'a', 'b' => 'b', 'c' => :c))
- .to eq(a: 'a', b: 'b', c: :c)
- end
- end
-
-
- end
-end
diff --git a/spec/views/imports/show.html.slim_spec.rb b/spec/views/imports/show.html.slim_spec.rb
index 1811d2acf..8576903fb 100644
--- a/spec/views/imports/show.html.slim_spec.rb
+++ b/spec/views/imports/show.html.slim_spec.rb
@@ -31,11 +31,8 @@ RSpec.describe '/imports/show', type: :view do
end
end
-
def rendered_message message
- Object.new.extend(CommonHelper).tap do |helper|
- return I18n.t(message.message_key, helper.string_keys_to_symbols( message.message_attributes ))
- end
+ return I18n.t message.message_key, message.message_attributes.symbolize_keys
end
end