diff options
| -rw-r--r-- | app/decorators/referential_decorator.rb | 2 | ||||
| -rw-r--r-- | spec/decorators/referential_decorator_spec.rb | 18 | 
2 files changed, 18 insertions, 2 deletions
| diff --git a/app/decorators/referential_decorator.rb b/app/decorators/referential_decorator.rb index e01987e59..db6261120 100644 --- a/app/decorators/referential_decorator.rb +++ b/app/decorators/referential_decorator.rb @@ -36,7 +36,7 @@ class ReferentialDecorator < AF83::Decorator        l.method :put      end -    instance_decorator.action_link policy: :unarchive, secondary: :show, on: :show do |l| +    instance_decorator.action_link policy: :unarchive, secondary: :show do |l|        l.content t('actions.unarchive')        l.href { h.unarchive_referential_path(object.id) }        l.method :put diff --git a/spec/decorators/referential_decorator_spec.rb b/spec/decorators/referential_decorator_spec.rb index 98546f28b..88c7df666 100644 --- a/spec/decorators/referential_decorator_spec.rb +++ b/spec/decorators/referential_decorator_spec.rb @@ -100,7 +100,10 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do      end      context 'archived referential' do -      before { referential.archived_at = 42.seconds.ago } +      before { +        referential.ready = true +        referential.archived_at = 42.seconds.ago +      }        context 'no rights' do          it 'has only show and calendar actions' do            expect_action_link_hrefs.to eq([[object], referential_time_tables_path(object)]) @@ -118,6 +121,19 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do            ])          end        end + +      context 'all rights and same organisation' do +        let( :user ){ build_stubbed :allmighty_user, organisation: referential.organisation } +        it 'has only default actions' do +          expect_action_link_elements.to eq ["Consulter", "Calendriers", "Dupliquer", "Désarchiver"] +          expect_action_link_hrefs.to eq([ +            [object], +            referential_time_tables_path(object), +            new_workbench_referential_path(referential.workbench, from: object.id), +            unarchive_referential_path(object), +          ]) +        end +      end      end    end | 
