|
201 | 201 |
|
202 | 202 | before do |
203 | 203 | allow(controller).to receive(:action_name).and_return('index') |
| 204 | + allow(helper.main_app).to receive(:track_test_path).and_return('tracking url') |
| 205 | + allow(helper.main_app).to receive(:respond_to?).with('track_test_path').and_return(true) |
204 | 206 | end |
205 | 207 |
|
206 | 208 | it "consists of the document title wrapped in a <a>" do |
|
248 | 250 | end |
249 | 251 |
|
250 | 252 | it "converts the counter parameter into a data- attribute" do |
251 | | - allow(helper).to receive(:track_test_path).with(hash_including(id: have_attributes(id: '123456'), counter: 5)).and_return('tracking url') |
252 | 253 | expect(Deprecation).to receive(:warn) |
253 | 254 | expect(helper.link_to_document(document, :title_tsim, counter: 5)).to include 'data-context-href="tracking url"' |
| 255 | + expect(helper.main_app).to have_received(:track_test_path).with(hash_including(id: have_attributes(id: '123456'), counter: 5)) |
254 | 256 | end |
255 | 257 |
|
256 | 258 | it "includes the data- attributes from the options" do |
|
259 | 261 | end |
260 | 262 |
|
261 | 263 | it 'adds a controller-specific tracking attribute' do |
262 | | - expect(helper).to receive(:track_test_path).and_return('/asdf') |
| 264 | + expect(helper.main_app).to receive(:track_test_path).and_return('/asdf') |
263 | 265 | link = helper.link_to_document document, data: { x: 1 } |
264 | 266 |
|
265 | 267 | expect(link).to have_selector '[data-context-href="/asdf"]' |
266 | 268 | end |
267 | | - |
268 | | - it 'adds a global tracking attribute' do |
269 | | - link = helper.link_to_document document, data: { x: 1 } |
270 | | - expect(link).to have_selector '[data-context-href="/catalog/123456/track"]' |
271 | | - end |
272 | 269 | end |
273 | 270 |
|
274 | 271 | describe "link_to_previous_search" do |
|
292 | 289 | let(:document) { SolrDocument.new(id: 1) } |
293 | 290 |
|
294 | 291 | it "determines the correct route for the document class" do |
295 | | - allow(helper).to receive(:track_test_path).with(id: have_attributes(id: 1)).and_return('x') |
| 292 | + allow(helper.main_app).to receive(:track_test_path).with(id: have_attributes(id: 1)).and_return('x') |
296 | 293 | expect(helper.session_tracking_path(document)).to eq 'x' |
297 | 294 | end |
298 | 295 |
|
299 | 296 | it "passes through tracking parameters" do |
300 | | - allow(helper).to receive(:track_test_path).with(id: have_attributes(id: 1), x: 1).and_return('x') |
| 297 | + allow(helper.main_app).to receive(:track_test_path).with(id: have_attributes(id: 1), x: 1).and_return('x') |
301 | 298 | expect(helper.session_tracking_path(document, x: 1)).to eq 'x' |
302 | 299 | end |
303 | 300 | end |
|
0 commit comments