mas-rad_core 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mas/firm_result.rb +8 -1
- data/lib/mas/rad_core/version.rb +1 -1
- data/spec/dummy/log/test.log +39803 -0
- data/spec/lib/mas/firm_result_spec.rb +19 -8
- metadata +1 -1
@@ -106,10 +106,6 @@ RSpec.describe FirmResult do
|
|
106
106
|
expect(subject.total_advisers).to eq(1)
|
107
107
|
end
|
108
108
|
|
109
|
-
it 'maps the `closest_adviser`' do
|
110
|
-
expect(subject.closest_adviser).to eq(0.7794549719530739)
|
111
|
-
end
|
112
|
-
|
113
109
|
it 'maps the `types_of_advice` that are greater than 0 percent' do
|
114
110
|
expect(subject.types_of_advice).to eq(
|
115
111
|
FirmResult::TYPES_OF_ADVICE_FIELDS - [:wills_and_probate]
|
@@ -136,11 +132,26 @@ RSpec.describe FirmResult do
|
|
136
132
|
expect(subject.adviser_qualification_ids).to eq([3])
|
137
133
|
end
|
138
134
|
|
139
|
-
|
140
|
-
|
135
|
+
describe '#closest_adviser' do
|
136
|
+
let(:text) { 'less than a mile away' }
|
137
|
+
|
138
|
+
before do
|
139
|
+
I18n.backend.store_translations :en,
|
140
|
+
search: { result: { miles_away_alt: text, miles_away: 'miles away' } }
|
141
|
+
end
|
142
|
+
|
143
|
+
context 'when it is less than 1 mile away' do
|
144
|
+
it 'returns `less than a mile away` localised text' do
|
145
|
+
expect(subject.closest_adviser).to eq(text)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
context 'when it is a mile away or more' do
|
150
|
+
before { data['sort'] = [1.23456789] }
|
141
151
|
|
142
|
-
|
143
|
-
|
152
|
+
it 'returns the formatted distance' do
|
153
|
+
expect(subject.closest_adviser).to eq('1.2 miles away')
|
154
|
+
end
|
144
155
|
end
|
145
156
|
end
|
146
157
|
end
|