From 61d0662dd923169c5c5aa1d4624f04d6e9dbe43d Mon Sep 17 00:00:00 2001 From: Marc Florisson Date: Wed, 29 Aug 2012 18:47:22 +0200 Subject: add subscription --- spec/support/referential.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'spec/support/referential.rb') diff --git a/spec/support/referential.rb b/spec/support/referential.rb index 0d3a7b89a..892903228 100644 --- a/spec/support/referential.rb +++ b/spec/support/referential.rb @@ -1,7 +1,7 @@ module ReferentialHelper def first_referential - Referential.find_by_slug("first") + Organisation.find_by_name("first").referentials.find_by_slug("first") end def self.included(base) @@ -27,7 +27,9 @@ RSpec.configure do |config| config.include ReferentialHelper config.before(:suite) do - Referential.find_or_create_by_slug FactoryGirl.attributes_for(:referential, :slug => "first") + organisation = Organisation.find_or_create_by_name :name => "first" + organisation.referentials.find_by_slug("first" ) || + FactoryGirl(:referential, :slug => "first", :organisation => organisation) # FIXME in Rails 3.2 : # Referential.where(:slug => 'first').first_or_create(FactoryGirl.attributes_for(:referential)) end -- cgit v1.2.3