diff options
| -rw-r--r-- | app/controllers/workbenches_controller.rb | 4 | ||||
| -rw-r--r-- | spec/features/workbenches_spec.rb | 4 | 
2 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb index da57268ec..1626ae039 100644 --- a/app/controllers/workbenches_controller.rb +++ b/app/controllers/workbenches_controller.rb @@ -3,7 +3,9 @@ class WorkbenchesController < BreadcrumbController    respond_to :html, :only => [:show]    def show -    @q = Workbench.find(params[:id]).all_referentials.ransack(params[:q]) +    scope = Workbench.find(params[:id]) +    scope = params[:q] ? scope.all_referentials : scope.referentials.ready +    @q = scope.ransack(params[:q])      @q.organisation_name_eq_any ||= current_organisation.name unless params[:q]      @collection = @q.result(distinct: true) diff --git a/spec/features/workbenches_spec.rb b/spec/features/workbenches_spec.rb index 9e636341d..4a074dad5 100644 --- a/spec/features/workbenches_spec.rb +++ b/spec/features/workbenches_spec.rb @@ -6,11 +6,11 @@ describe 'Workbenches', type: :feature do    let!(:organisations) { Array.new(2) { create :organisation } }    let!(:referentials) { Array.new(2) { create :referential, ready: true } }    let!(:line_referential) { create :line_referential } -  let!(:workbenches) { Array.new(2) { create :workbench, line_referential: line_referential } } +  let!(:workbenches) { Array.new(2) { create :workbench, line_referential: line_referential, organisation: @user.organisation } }    let!(:line) { create :line, line_referential: line_referential }    let!(:referential_metadatas) { Array.new(2) { |i| create :referential_metadata, lines: [line], referential: referentials[i] } } -  let!(:ready_referential) { create(:referential, workbench: workbenches.first, metadatas: referential_metadatas, ready: true) } +  let!(:ready_referential) { create(:referential, workbench: workbenches.first, metadatas: referential_metadatas, ready: true, organisation: @user.organisation) }    let!(:unready_referential) { create(:referential, workbench: workbenches.first) }    describe 'show' do  | 
