aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/referential_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/referential_spec.rb')
-rw-r--r--spec/models/referential_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb
index 2fb8b5cb0..220201d37 100644
--- a/spec/models/referential_spec.rb
+++ b/spec/models/referential_spec.rb
@@ -73,6 +73,26 @@ describe Referential, :type => :model do
expect(Referential.archived).to include referential
end
end
+
+ context 'pending_while' do
+ it "should preserve the state" do
+ referential = create :referential
+ referential.archived!
+ expect(referential.state).to eq :archived
+ referential.pending_while do
+ expect(referential.state).to eq :pending
+ end
+ expect(referential.state).to eq :archived
+ begin
+ referential.pending_while do
+ expect(referential.state).to eq :pending
+ raise
+ end
+ rescue
+ end
+ expect(referential.state).to eq :archived
+ end
+ end
end
context ".referential_ids_in_periode" do