diff options
| author | Zog | 2018-04-27 15:07:25 +0200 | 
|---|---|---|
| committer | Johan Van Ryseghem | 2018-04-27 15:13:51 +0200 | 
| commit | e1425294874b4cd4d71668e7669220252ea2e936 (patch) | |
| tree | 89d2877305ad5e066e47f3692b1d0b619c381eb1 /spec/decorators | |
| parent | 3ed5ca0e97c287977646b7af6a41632c9dd3ad49 (diff) | |
| download | chouette-core-e1425294874b4cd4d71668e7669220252ea2e936.tar.bz2 | |
Refs #6572; Fix specs
Diffstat (limited to 'spec/decorators')
| -rw-r--r-- | spec/decorators/referential_decorator_spec.rb | 30 | 
1 files changed, 26 insertions, 4 deletions
| diff --git a/spec/decorators/referential_decorator_spec.rb b/spec/decorators/referential_decorator_spec.rb index 1224aaf75..98546f28b 100644 --- a/spec/decorators/referential_decorator_spec.rb +++ b/spec/decorators/referential_decorator_spec.rb @@ -41,12 +41,11 @@ 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 }          let( :action){ :index }          context "on index" do            it 'has corresponding actions' do -            expect_action_link_elements(action).to eq ["Consulter", "Editer", "Calendriers", "Dupliquer", "Valider", "Conserver","<span class=\"fa fa-trash mr-xs\"></span>Supprimer"] +            expect_action_link_elements(action).to eq ["Consulter", "Editer", "Calendriers", "Dupliquer", "Valider", "Archiver","<span class=\"fa fa-trash mr-xs\"></span>Supprimer"]              expect_action_link_hrefs(action).to eq([                [object],                [:edit, object], @@ -62,7 +61,7 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do          context "on show" do            let( :action){ :show }            it 'has corresponding actions' do -            expect_action_link_elements(action).to eq ["Editer", "Calendriers", "Dupliquer", "Valider", "Conserver", "Purger", "<span class=\"fa fa-trash mr-xs\"></span>Supprimer"] +            expect_action_link_elements(action).to eq ["Editer", "Calendriers", "Dupliquer", "Valider", "Archiver", "Purger", "<span class=\"fa fa-trash mr-xs\"></span>Supprimer"]              expect_action_link_hrefs(action).to eq([                [:edit, object],                referential_time_tables_path(object), @@ -74,13 +73,36 @@ RSpec.describe ReferentialDecorator, type: [:helper, :decorator] do              ])            end          end + +        context 'with a failed referential' do +          before{ +            referential.ready = false +            referential.failed_at = Time.now +          } +          context "on index" do +            it 'has corresponding actions' do +              expect_action_link_elements(action).to eq ["Consulter"] +              expect_action_link_hrefs(action).to eq([ +                [object], +              ]) +            end +          end + +          context "on show" do +            let( :action){ :show } +            it 'has corresponding actions' do +              expect_action_link_elements(action).to eq [] +              expect_action_link_hrefs(action).to eq([]) +            end +          end +        end        end      end      context 'archived referential' do        before { referential.archived_at = 42.seconds.ago }        context 'no rights' do -        it 'has only ahow and calendar actions' do +        it 'has only show and calendar actions' do            expect_action_link_hrefs.to eq([[object], referential_time_tables_path(object)])          end        end | 
