aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZog2018-05-03 10:13:34 +0200
committerZog2018-05-03 10:13:34 +0200
commit7839c6cc052156383d17be27df864f92f40f273c (patch)
treea21377ce2278fcc9f940055575a3a680ee726bc2
parent6f7865568e74f8268d067c4f961ece9dd4a76d41 (diff)
downloadchouette-core-7839c6cc052156383d17be27df864f92f40f273c.tar.bz2
Refs #6920; Fix typo
-rw-r--r--app/models/referential.rb2
-rw-r--r--spec/models/referential_spec.rb11
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