diff options
| author | Marc Florisson | 2012-06-27 15:09:35 +0200 |
|---|---|---|
| committer | Marc Florisson | 2012-06-27 15:09:35 +0200 |
| commit | a96398d24c195c0224e985be9a12b8bd12f76143 (patch) | |
| tree | b3c14c57fb67c50468ce0e77558c74b592b22b09 /spec/support/referential.rb | |
| parent | b9e5f8f5dd642e7efd7969a3dd1571edea2facb8 (diff) | |
| parent | d3f748e11b0dd11a3678aeb45dae8143124653e7 (diff) | |
| download | chouette-core-a96398d24c195c0224e985be9a12b8bd12f76143.tar.bz2 | |
Merge branch 'master' of chouette.dryade.priv:/srv/git/chouette2
Diffstat (limited to 'spec/support/referential.rb')
| -rw-r--r-- | spec/support/referential.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/support/referential.rb b/spec/support/referential.rb new file mode 100644 index 000000000..0d3a7b89a --- /dev/null +++ b/spec/support/referential.rb @@ -0,0 +1,39 @@ +module ReferentialHelper + + def first_referential + Referential.find_by_slug("first") + end + + def self.included(base) + base.class_eval do + extend ClassMethods + alias_method :referential, :first_referential + end + end + + module ClassMethods + + def assign_referential + before(:each) do + assign :referential, referential + end + end + + end + +end + +RSpec.configure do |config| + config.include ReferentialHelper + + config.before(:suite) do + Referential.find_or_create_by_slug FactoryGirl.attributes_for(:referential, :slug => "first") + # FIXME in Rails 3.2 : + # Referential.where(:slug => 'first').first_or_create(FactoryGirl.attributes_for(:referential)) + end + + config.before(:each) do + first_referential.switch + end + +end |
