diff options
| -rw-r--r-- | app/controllers/referentials_controller.rb | 1 | ||||
| -rw-r--r-- | app/models/referential.rb | 5 | ||||
| -rw-r--r-- | spec/controllers/referentials_controller_spec.rb | 1 | ||||
| -rw-r--r-- | spec/models/referential/referential_oid_format_from_wkbch_spec.rb | 3 | ||||
| -rw-r--r-- | spec/models/referential_spec.rb | 1 | 
5 files changed, 7 insertions, 4 deletions
| diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index 8addfbc32..80f954cde 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -136,7 +136,6 @@ class ReferentialsController < ChouetteController    def create_resource(referential)      referential.organisation = current_organisation -    referential.ready = true      super    end diff --git a/app/models/referential.rb b/app/models/referential.rb index 933bc78e3..b4f64fad1 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -59,7 +59,6 @@ class Referential < ApplicationModel    belongs_to :referential_suite -    scope :pending, -> { where(ready: false, failed_at: nil, archived_at: nil) }    scope :active, -> { where(ready: true, failed_at: nil, archived_at: nil) }    scope :failed, -> { where.not(failed_at: nil) } @@ -271,7 +270,8 @@ class Referential < ApplicationModel        stop_area_referential: from.stop_area_referential,        created_from: from,        objectid_format: from.objectid_format, -      metadatas: from.metadatas.map { |m| ReferentialMetadata.new_from(m, organisation) } +      metadatas: from.metadatas.map { |m| ReferentialMetadata.new_from(m, organisation) }, +      ready: false      )    end @@ -471,6 +471,7 @@ class Referential < ApplicationModel    end    def destroy_schema +    return unless ActiveRecord::Base.connection.schema_names.include?(slug)      Apartment::Tenant.drop slug    end diff --git a/spec/controllers/referentials_controller_spec.rb b/spec/controllers/referentials_controller_spec.rb index acab3abd9..8edd8699f 100644 --- a/spec/controllers/referentials_controller_spec.rb +++ b/spec/controllers/referentials_controller_spec.rb @@ -119,6 +119,7 @@ describe ReferentialsController, :type => :controller do        it "creates the new referential" do          expect{request}.to change{Referential.count}.by 1          expect(Referential.last.name).to eq "Duplicated" +        expect(Referential.last.state).to eq :pending        end        it "displays a flash message" do diff --git a/spec/models/referential/referential_oid_format_from_wkbch_spec.rb b/spec/models/referential/referential_oid_format_from_wkbch_spec.rb index 6783ab55d..a693e80c9 100644 --- a/spec/models/referential/referential_oid_format_from_wkbch_spec.rb +++ b/spec/models/referential/referential_oid_format_from_wkbch_spec.rb @@ -58,7 +58,8 @@ RSpec.describe Referential do        stop_area_referential: source.stop_area_referential,        created_from: source,        objectid_format: source.objectid_format, -      metadatas: source.metadatas.map { |m| ReferentialMetadata.new_from(m, functional_scope) }) +      metadatas: source.metadatas.map { |m| ReferentialMetadata.new_from(m, functional_scope) }, +      ready: false)        described_class.new_from( source, functional_scope )      end diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb index eb9c2e338..720cec48c 100644 --- a/spec/models/referential_spec.rb +++ b/spec/models/referential_spec.rb @@ -203,6 +203,7 @@ describe Referential, :type => :model do      it 'should create a Referential' do        ref        expect { saved_clone }.to change{Referential.count}.by(1) +      expect(saved_clone.state).to eq :pending      end      xit 'should create a ReferentialCloning' do | 
