aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorXinhui2016-10-18 15:34:47 +0200
committerXinhui2016-10-18 15:34:53 +0200
commitf9814e27bcaabbf69c66f43989236e40a334e0c1 (patch)
tree7d16d0b33fb83d732b918fbd08d29c839ddb5478 /spec
parenta9aa01e2271fda736e13d1a10bd62f45e1508330 (diff)
downloadchouette-core-f9814e27bcaabbf69c66f43989236e40a334e0c1.tar.bz2
Relation Workbench - LineReferential & StopAreaReferential
Refs #1784
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/chouette_2_factories.rb4
-rw-r--r--spec/factories/workbenches.rb2
-rw-r--r--spec/models/line_referential_spec.rb1
-rw-r--r--spec/models/stop_area_referential_spec.rb1
-rw-r--r--spec/models/workbench_spec.rb3
-rw-r--r--spec/support/referential.rb6
6 files changed, 15 insertions, 2 deletions
diff --git a/spec/factories/chouette_2_factories.rb b/spec/factories/chouette_2_factories.rb
index b88b0d773..e8eba13e6 100644
--- a/spec/factories/chouette_2_factories.rb
+++ b/spec/factories/chouette_2_factories.rb
@@ -10,7 +10,9 @@ FactoryGirl.define do
sequence(:slug) { |n| "test_#{n}" }
sequence(:prefix) { |n| "test_#{n}" }
association :organisation
-
+ association :workbench
+ association :line_referential
+ association :stop_area_referential
time_zone "Europe/Paris"
end
diff --git a/spec/factories/workbenches.rb b/spec/factories/workbenches.rb
index 16c673655..f51e7d94c 100644
--- a/spec/factories/workbenches.rb
+++ b/spec/factories/workbenches.rb
@@ -3,5 +3,7 @@ FactoryGirl.define do
sequence(:name) { |n| "Workbench #{n}" }
association :organisation, :factory => :organisation
+ association :line_referential
+ association :stop_area_referential
end
end
diff --git a/spec/models/line_referential_spec.rb b/spec/models/line_referential_spec.rb
index 8b06f07ad..02838a4a7 100644
--- a/spec/models/line_referential_spec.rb
+++ b/spec/models/line_referential_spec.rb
@@ -7,5 +7,6 @@ RSpec.describe LineReferential, :type => :model do
it { should validate_presence_of(:name) }
it { is_expected.to have_many(:line_referential_syncs) }
+ it { is_expected.to have_many(:workbenches) }
it { should validate_presence_of(:sync_interval) }
end
diff --git a/spec/models/stop_area_referential_spec.rb b/spec/models/stop_area_referential_spec.rb
index 87b99b18b..271badff8 100644
--- a/spec/models/stop_area_referential_spec.rb
+++ b/spec/models/stop_area_referential_spec.rb
@@ -6,4 +6,5 @@ RSpec.describe StopAreaReferential, :type => :model do
end
it { is_expected.to have_many(:stop_area_referential_syncs) }
+ it { is_expected.to have_many(:workbenches) }
end
diff --git a/spec/models/workbench_spec.rb b/spec/models/workbench_spec.rb
index bafe95e75..023a65ea2 100644
--- a/spec/models/workbench_spec.rb
+++ b/spec/models/workbench_spec.rb
@@ -9,4 +9,7 @@ RSpec.describe Workbench, :type => :model do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:organisation) }
+ it { should belong_to(:organisation) }
+ it { should belong_to(:line_referential) }
+ it { should belong_to(:stop_area_referential) }
end
diff --git a/spec/support/referential.rb b/spec/support/referential.rb
index ddad29963..03f5a0977 100644
--- a/spec/support/referential.rb
+++ b/spec/support/referential.rb
@@ -43,8 +43,12 @@ RSpec.configure do |config|
line_referential = LineReferential.find_or_create_by(name: "first") do |referential|
referential.add_member organisation, owner: true
end
+ stop_area_referential = StopAreaReferential.find_or_create_by(name: "first") do |referential|
+ referential.add_member organisation, owner: true
+ end
- Referential.create! prefix: "first", name: "first", slug: "first", organisation: organisation, line_referential: line_referential
+ workbench = Workbench.create!(:name => "first", organisation: organisation, line_referential: line_referential, stop_area_referential: stop_area_referential)
+ Referential.create! prefix: "first", name: "first", slug: "first", organisation: organisation, workbench: workbench
end
config.before(:each) do