aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/referential_group_of_lines_spec.rb
blob: e5970545b66153f072480c199707f79ba372cf84 (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
# -*- coding: utf-8 -*-
require 'spec_helper'

describe 'ReferentialLines', type: :feature do
  login_user

  let(:referential) { Referential.first }
  let!(:group_of_lines) { Array.new(2) { create(:group_of_line, line_referential: referential.line_referential) } }

  describe 'index' do
    before(:each) { visit referential_group_of_lines_path(referential) }

    it 'displays referential groups of lines' do
      expect(page).to have_content(group_of_lines.first.name)
      expect(page).to have_content(group_of_lines.last.name)
    end

    context 'filtering' do
      it 'supports filtering by name' do
        fill_in 'q[name_cont]', with: group_of_lines.first.name
        click_button 'search-btn'
        expect(page).to have_content(group_of_lines.first.name)
        expect(page).not_to have_content(group_of_lines.last.name)
      end
    end
  end

  describe 'show' do
    it 'displays referential group of lines' do
      visit referential_group_of_line_path(referential, group_of_lines.first)
      expect(page).to have_content(group_of_lines.first.name)
    end
  end
end