diff options
| -rw-r--r-- | app/views/workbenches/show.html.slim | 5 | ||||
| -rw-r--r-- | db/migrate/20180502075142_revert_routing_constraint_zones_stop_ids_type.rb | 8 | ||||
| -rw-r--r-- | spec/features/workbenches/workbenches_show_spec.rb | 21 | 
3 files changed, 33 insertions, 1 deletions
| diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim index b0276c5ce..213c9e5f2 100644 --- a/app/views/workbenches/show.html.slim +++ b/app/views/workbenches/show.html.slim @@ -62,7 +62,10 @@                    attribute: Proc.new {|w| w.merged_at ? l(w.merged_at, format: :short) : '-'} \                  ) \                ], -              selectable: ->(ref){ @workbench.referentials.include?(ref) }, +              selectable: ->(ref) { \ +                @workbench.referentials.include?(ref) && \ +                  !ref.pending? \ +              },                cls: 'table has-filter has-search',                action: :index diff --git a/db/migrate/20180502075142_revert_routing_constraint_zones_stop_ids_type.rb b/db/migrate/20180502075142_revert_routing_constraint_zones_stop_ids_type.rb new file mode 100644 index 000000000..e5213a520 --- /dev/null +++ b/db/migrate/20180502075142_revert_routing_constraint_zones_stop_ids_type.rb @@ -0,0 +1,8 @@ +class RevertRoutingConstraintZonesStopIdsType < ActiveRecord::Migration +  def change +    reversible do |dir| +      dir.up { change_column :routing_constraint_zones, :stop_point_ids, :bigint, array: true } +      dir.down { change_column :routing_constraint_zones, :stop_point_ids, :integer, array: true } +    end +  end +end diff --git a/spec/features/workbenches/workbenches_show_spec.rb b/spec/features/workbenches/workbenches_show_spec.rb index 441f829a1..427b526cf 100644 --- a/spec/features/workbenches/workbenches_show_spec.rb +++ b/spec/features/workbenches/workbenches_show_spec.rb @@ -64,6 +64,27 @@ RSpec.describe 'Workbenches', type: :feature do          "Couldn't find `hidden_referential`: `#{hidden_referential.inspect}`"      end +    it "prevents pending referentials from being selected" do +      line = create(:line, line_referential: line_ref) +      metadata = create(:referential_metadata, lines: [line]) +      pending_referential = create( +        :workbench_referential, +        workbench: workbench, +        metadatas: [metadata], +        organisation: @user.organisation, +        ready: false +      ) + +      visit workbench_path(workbench) + +      expect( +        find("input[type='checkbox'][value='#{referential.id}']") +      ).not_to be_disabled +      expect( +        find("input[type='checkbox'][value='#{pending_referential.id}']") +      ).to be_disabled +    end +      context 'filtering' do        let!(:another_organisation) { create :organisation }        let(:another_line) { create :line, line_referential: line_ref } | 
