aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/referential.rb
diff options
context:
space:
mode:
authorMarc Florisson2012-08-29 18:47:22 +0200
committerMarc Florisson2012-08-29 18:47:22 +0200
commit61d0662dd923169c5c5aa1d4624f04d6e9dbe43d (patch)
tree19e5943eb061cf1bb09709cb236fa10007064e32 /spec/support/referential.rb
parent6fd69ca92e3090a2a8b7b73e7511bc1070290e22 (diff)
downloadchouette-core-61d0662dd923169c5c5aa1d4624f04d6e9dbe43d.tar.bz2
add subscription
Diffstat (limited to 'spec/support/referential.rb')
-rw-r--r--spec/support/referential.rb6
1 files changed, 4 insertions, 2 deletions
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