diff options
| author | Teddy Wing | 2018-01-15 17:36:58 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-01-15 18:25:52 +0100 | 
| commit | 88b1e7c640d89d5bb435e4e415105b071ef0d457 (patch) | |
| tree | 455c246de077f7db95a3bd6549a979dbf57597d7 /spec/features | |
| parent | d5543a0875a4c6f9bd06268dff49c0fe41751e91 (diff) | |
| download | chouette-core-88b1e7c640d89d5bb435e4e415105b071ef0d457.tar.bz2 | |
workbenches_show_spec: Test organisations in filtration list
Check that only `Organisation`s associated with the current `Workgroup`
appear in the list of filters on `Workbenches#show`.
Also rewrite the `other_referential` object to put it in a different
workbench from the first referential, enabling us to have multiple
organisations in the same `Workgroup`.
Refs #5140
Diffstat (limited to 'spec/features')
| -rw-r--r-- | spec/features/workbenches/workbenches_show_spec.rb | 30 | 
1 files changed, 29 insertions, 1 deletions
| diff --git a/spec/features/workbenches/workbenches_show_spec.rb b/spec/features/workbenches/workbenches_show_spec.rb index f1151a67b..2b215bb03 100644 --- a/spec/features/workbenches/workbenches_show_spec.rb +++ b/spec/features/workbenches/workbenches_show_spec.rb @@ -26,7 +26,23 @@ RSpec.describe 'Workbenches', type: :feature do        let!(:another_organisation) { create :organisation }        let(:another_line) { create :line, line_referential: line_ref }        let(:another_ref_metadata) { create(:referential_metadata, lines: [another_line]) } -      let!(:other_referential) { create :workbench_referential, workbench: workbench, metadatas: [another_ref_metadata] } +      let(:other_workbench) do +        create( +          :workbench, +          line_referential: line_ref, +          organisation: another_organisation, +          workgroup: workbench.workgroup +        ) +      end +      let!(:other_referential) do +        create( +          :workbench_referential, +          workbench: other_workbench, +          metadatas: [another_ref_metadata], +          organisation: other_workbench.organisation +        ) +      end +        before(:each) do          visit workbench_path(workbench) @@ -64,6 +80,18 @@ RSpec.describe 'Workbenches', type: :feature do            click_button I18n.t('actions.filter')            expect(find(box)).to be_checked          end + +        it 'only lists organisations in the current workgroup' do +          unaffiliated_workbench = workbench.dup +          unaffiliated_workbench.update(organisation: create(:organisation)) + +          expect(page).to have_selector( +            "#q_organisation_name_eq_any_#{@user.organisation.name.parameterize.underscore}" +          ) +          expect(page).to_not have_selector( +            "#q_organisation_name_eq_any_#{unaffiliated_workbench.name.parameterize.underscore}" +          ) +        end        end        context 'filter by status' do | 
