diff options
Diffstat (limited to 'spec/features/referential_lines_spec.rb')
| -rw-r--r-- | spec/features/referential_lines_spec.rb | 49 | 
1 files changed, 49 insertions, 0 deletions
| diff --git a/spec/features/referential_lines_spec.rb b/spec/features/referential_lines_spec.rb new file mode 100644 index 000000000..ea828e6cb --- /dev/null +++ b/spec/features/referential_lines_spec.rb @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +require 'spec_helper' + +describe 'ReferentialLines', type: :feature do +  login_user + +  before(:all) { create :referential_metadata, referential: Referential.first } + +  let(:referential) { Referential.first } + +  describe 'index' do +    before(:each) { visit referential_lines_path(referential) } + +    it 'displays referential lines' do +      expect(page).to have_content(referential.lines.first.name) +      expect(page).to have_content(referential.lines.last.name) +    end + +    context 'fitering' do +      it 'supports filtering by name' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: referential.lines.first.name +        click_button 'search-btn' +        expect(page).to have_content(referential.lines.first.name) +        expect(page).not_to have_content(referential.lines.last.name) +      end + +      it 'supports filtering by number' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: referential.lines.first.number +        click_button 'search-btn' +        expect(page).to have_content(referential.lines.first.name) +        expect(page).not_to have_content(referential.lines.last.name) +      end + +      it 'supports filtering by objectid' do +        fill_in 'q[name_or_number_or_objectid_cont]', with: referential.lines.first.objectid +        click_button 'search-btn' +        expect(page).to have_content(referential.lines.first.name) +        expect(page).not_to have_content(referential.lines.last.name) +      end +    end +  end + +  describe 'show' do +    it 'displays referential line' do +      visit referential_line_path(referential, referential.lines.first) +      expect(page).to have_content(referential.lines.first.name) +    end +  end +end | 
