aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/referential.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/referential.rb')
-rw-r--r--spec/support/referential.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/support/referential.rb b/spec/support/referential.rb
index 28f3799ec..e581e9a3a 100644
--- a/spec/support/referential.rb
+++ b/spec/support/referential.rb
@@ -1,13 +1,17 @@
module ReferentialHelper
def first_referential
- Organisation.find_by_name("first").referentials.find_by_slug("first")
+ first_organisation.referentials.find_by_slug("first")
+ end
+ def first_organisation
+ Organisation.find_by_name("first")
end
def self.included(base)
base.class_eval do
extend ClassMethods
alias_method :referential, :first_referential
+ alias_method :organisation, :first_organisation
end
end
@@ -18,6 +22,12 @@ module ReferentialHelper
assign :referential, referential
end
end
+ def assign_organisation
+ before(:each) do
+ assign :organisation, referential.organisation
+ end
+ end
+
end
@@ -29,7 +39,7 @@ RSpec.configure do |config|
config.before(:suite) do
organisation = Organisation.find_or_create_by_name :name => "first"
organisation.referentials.find_by_slug("first" ) ||
- Referential.create(:prefix => "first", :name => "first", :slug => "first", :organisation => organisation)
+ Referential.create(:prefix => "first", :name => "first", :slug => "first", :organisation => organisation)
# FIXME in Rails 3.2 :
# Referential.where(:slug => 'first').first_or_create(FactoryGirl.attributes_for(:referential))
end