blob: 14da3a725de178455202cabffe7d43b3f5b70662 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 | # -*- coding: utf-8 -*-
require 'spec_helper'
describe 'ReferentialStopAreas', type: :feature do
  login_user
  let(:referential) { Referential.first }
  let(:stop_area_referential) { referential.stop_area_referential }
  let!(:stop_areas) { Array.new(2) { create :stop_area, stop_area_referential: stop_area_referential } }
  describe 'index' do
    before(:each) { visit stop_area_referential_stop_areas_path(referential.workbench.stop_area_referential) }
    it 'displays referential stop_areas' do
      expect(page).to have_content(stop_areas.first.name)
      expect(page).to have_content(stop_areas.last.name)
    end
    context 'filtering' do
      it 'supports filtering by name' do
        fill_in 'q[name_or_objectid_or_registration_number_cont]', with: stop_areas.first.name
        click_button 'search-btn'
        expect(page).to have_content(stop_areas.first.name)
        expect(page).not_to have_content(stop_areas.last.name)
      end
      it 'supports filtering by objectid' do
        fill_in 'q[name_or_objectid_or_registration_number_cont]', with: stop_areas.first.objectid
        click_button 'search-btn'
        expect(page).to have_content(stop_areas.first.name)
        expect(page).not_to have_content(stop_areas.last.name)
      end
    end
  end
  describe 'show' do
    it 'displays referential stop area' do
      visit stop_area_referential_stop_area_path(stop_areas.first.stop_area_referential, stop_areas.first)
      expect(page).to have_content(stop_areas.first.name)
    end
  end
end
 |