diff options
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 | 
