From e1425294874b4cd4d71668e7669220252ea2e936 Mon Sep 17 00:00:00 2001
From: Zog
Date: Fri, 27 Apr 2018 15:07:25 +0200
Subject: Refs #6572; Fix specs
---
spec/decorators/referential_decorator_spec.rb | 30 +++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
(limited to 'spec/decorators')
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","Supprimer"]
+ expect_action_link_elements(action).to eq ["Consulter", "Editer", "Calendriers", "Dupliquer", "Valider", "Archiver","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", "Supprimer"]
+ expect_action_link_elements(action).to eq ["Editer", "Calendriers", "Dupliquer", "Valider", "Archiver", "Purger", "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
--
cgit v1.2.3