diff options
| author | Teddy Wing | 2018-01-16 17:24:12 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-01-16 17:24:12 +0100 | 
| commit | 93b60066cc49d699171d6a50798c5939a4644eea (patch) | |
| tree | 309fe6039fb1881cac5360c80661548eb36e182e /spec/features | |
| parent | b1c55750bb43736c2cb6f9619bddc453cfadb1aa (diff) | |
| download | chouette-core-93b60066cc49d699171d6a50798c5939a4644eea.tar.bz2 | |
workbenches/show: Filter referentials by workgroup
Previously, all `Referential`s would be listed on this page if they had
matching line metadata. Now, we exclude those referentials that are in
other workgroups to ensure users don't see referentials they're not
supposed to see.
Refs #5592
Diffstat (limited to 'spec/features')
| -rw-r--r-- | spec/features/workbenches/workbenches_show_spec.rb | 42 | 
1 files changed, 42 insertions, 0 deletions
| diff --git a/spec/features/workbenches/workbenches_show_spec.rb b/spec/features/workbenches/workbenches_show_spec.rb index 2b215bb03..7be813b94 100644 --- a/spec/features/workbenches/workbenches_show_spec.rb +++ b/spec/features/workbenches/workbenches_show_spec.rb @@ -22,6 +22,48 @@ RSpec.describe 'Workbenches', type: :feature do        end      end +    it 'lists referentials in the current workgroup' do +      other_workbench = create( +        :workbench, +        line_referential: line_ref, +        workgroup: workbench.workgroup +      ) +      other_referential = create( +        :workbench_referential, +        workbench: other_workbench, +        organisation: other_workbench.organisation, +        metadatas: [ +          create( +            :referential_metadata, +            lines: [create(:line, line_referential: line_ref)] +          ) +        ] +      ) + +      hidden_referential = create( +        :workbench_referential, +        workbench: create( +          :workbench, +          line_referential: line_ref +        ), +        metadatas: [ +          create( +            :referential_metadata, +            lines: [create(:line, line_referential: line_ref)] +          ) +        ] +      ) + +      visit workbench_path(workbench) + +      expect(page).to have_content(referential.name), +        "Couldn't find `referential`: `#{referential.inspect}`" +      expect(page).to have_content(other_referential.name), +        "Couldn't find `other_referential`: `#{other_referential.inspect}`" +      expect(page).to_not have_content(hidden_referential.name), +        "Couldn't find `hidden_referential`: `#{hidden_referential.inspect}`" +    end +      context 'filtering' do        let!(:another_organisation) { create :organisation }        let(:another_line) { create :line, line_referential: line_ref } | 
