diff options
| author | Alban Peignier | 2016-05-15 09:22:06 +0200 |
|---|---|---|
| committer | Alban Peignier | 2016-05-15 09:22:06 +0200 |
| commit | affbacfcd955230f66badb261dcc462cca9cd0b9 (patch) | |
| tree | 5410864baa11d3e5b24671cfb8f9258aaa833e62 /spec | |
| parent | f5a3f0061fed4f8f51ebc0d556539a483626f76e (diff) | |
| download | chouette-core-affbacfcd955230f66badb261dcc462cca9cd0b9.tar.bz2 | |
Associate LineReferential to Referential. Create ReferentialLines to manage lines in Referential. Refs #826
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/factories/chouette_lines.rb | 4 | ||||
| -rw-r--r-- | spec/support/referential.rb | 7 | ||||
| -rw-r--r-- | spec/views/lines/new.html.erb_spec.rb | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/spec/factories/chouette_lines.rb b/spec/factories/chouette_lines.rb index 35de831b1..0a720da48 100644 --- a/spec/factories/chouette_lines.rb +++ b/spec/factories/chouette_lines.rb @@ -8,7 +8,9 @@ FactoryGirl.define do association :network, :factory => :network association :company, :factory => :company - association :line_referential + before(:create) do |line| + line.line_referential ||= LineReferential.find_by! name: "first" + end sequence(:registration_number) { |n| "test-#{n}" } diff --git a/spec/support/referential.rb b/spec/support/referential.rb index 8c468eb53..ddad29963 100644 --- a/spec/support/referential.rb +++ b/spec/support/referential.rb @@ -39,7 +39,12 @@ RSpec.configure do |config| Apartment::Tenant.drop('first') rescue nil # Create the default tenant for our tests organisation = Organisation.create!(:name => "first") - Referential.create!(:prefix => "first", :name => "first", :slug => "first", :organisation => organisation) + + line_referential = LineReferential.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 end config.before(:each) do diff --git a/spec/views/lines/new.html.erb_spec.rb b/spec/views/lines/new.html.erb_spec.rb index 8b09f9ce9..ae38099d5 100644 --- a/spec/views/lines/new.html.erb_spec.rb +++ b/spec/views/lines/new.html.erb_spec.rb @@ -4,8 +4,8 @@ describe "/lines/new", :type => :view do let!(:network) { create(:network) } let!(:company) { create(:company) } - let!(:line) { assign(:line, build(:line, :network => network, :company => company )) } - let!(:line_referential) { assign :line_referential, line.line_referential } + let!(:line) { assign(:line, build(:line, :network => network, :company => company, line_referential: referential.line_referential )) } + let!(:line_referential) { assign :line_referential, referential.line_referential } describe "form" do |
