diff options
| author | Zog | 2018-04-18 09:59:15 +0200 | 
|---|---|---|
| committer | Johan Van Ryseghem | 2018-04-27 11:17:19 +0200 | 
| commit | 0046e5a01cb08c10118b01c50f3c52d159854ef0 (patch) | |
| tree | 6e690461a9266716d31f14611235eab9f1f76e33 /spec | |
| parent | 681f874e3150c35b03e74b25827b74791ae9ae95 (diff) | |
| download | chouette-core-0046e5a01cb08c10118b01c50f3c52d159854ef0.tar.bz2 | |
Refs #6572; Use new states
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/factories/clean_ups.rb | 1 | ||||
| -rw-r--r-- | spec/models/merge_spec.rb | 3 | ||||
| -rw-r--r-- | spec/models/referential_spec.rb | 20 | 
3 files changed, 24 insertions, 0 deletions
| diff --git a/spec/factories/clean_ups.rb b/spec/factories/clean_ups.rb index 7107769ff..e366a113b 100644 --- a/spec/factories/clean_ups.rb +++ b/spec/factories/clean_ups.rb @@ -1,5 +1,6 @@  FactoryGirl.define do    factory :clean_up do +    referential      begin_date { Date.today}      end_date   { Date.today + 1.month }      date_type  { :before } diff --git a/spec/models/merge_spec.rb b/spec/models/merge_spec.rb index 242fcddcd..5d5320930 100644 --- a/spec/models/merge_spec.rb +++ b/spec/models/merge_spec.rb @@ -109,6 +109,9 @@ RSpec.describe Merge do        end      end +    expect(output.state).to eq :ready +    expect(referential.reload.state).to eq :archived +    end  end 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 | 
