diff options
| -rw-r--r-- | app/models/referential.rb | 2 | ||||
| -rw-r--r-- | spec/models/referential_spec.rb | 11 | 
2 files changed, 11 insertions, 2 deletions
| diff --git a/app/models/referential.rb b/app/models/referential.rb index cabce85d6..792353a73 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -322,7 +322,7 @@ class Referential < ApplicationModel    before_create :create_schema    after_create :clone_schema, if: :created_from -  after_create :active!, unles: :created_from +  after_create :active!, unless: :created_from    before_destroy :destroy_schema    before_destroy :destroy_jobs diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb index 720cec48c..2ca0e737d 100644 --- a/spec/models/referential_spec.rb +++ b/spec/models/referential_spec.rb @@ -29,6 +29,14 @@ describe Referential, :type => :model do      end    end +  context "creation" do +    subject(:referential) { Referential.create name: "test", objectid_format: :netex, organisation: create(:organisation), line_referential: create(:line_referential), stop_area_referential: create(:stop_area_referential) } +    it "should activate by default" do +      expect(referential).to be_valid +      expect(referential.state).to eq :active +    end +  end +    context ".last_operation" do      subject(:operation){ referential.last_operation }      it "should return nothing" do @@ -110,7 +118,8 @@ describe Referential, :type => :model do      context "the scopes" do        it "should filter the referentials" do -        referential = create :referential, ready: false +        referential = create :referential +        referential.pending!          expect(Referential.pending).to include referential          expect(Referential.failed).to_not include referential          expect(Referential.active).to_not include referential | 
