Permalink
Browse files

Move FixtureExampleGroupBehaviour to RSpec::Rails::FixtureSupport

  • Loading branch information...
dchelimsky committed May 28, 2010
1 parent 10a8c5a commit b39e5fd24b051d7680579f6541bbc1de9b5b7c73
@@ -72,6 +72,8 @@ Feature: transactional examples
it "has one after one was created in a previous example" do
Widget.count.should == 1
end
after(:all) { Widget.destroy_all }
end
"""
When I run "rspec spec/models/widget_spec.rb"
View
@@ -4,19 +4,8 @@
require 'rspec/rails/null_resolver'
require 'rspec/rails/view_rendering'
require 'rspec/rails/adapters'
require 'rspec/core'
require 'rspec/rails/matchers'
require 'rspec/rails/example'
require 'rspec/rails/fixture_support'
require 'rspec/rails/mocks'
require 'rspec/rails/configuration'
RSpec.configure do |c|
c.add_option :use_transactional_examples, :type => :boolean, :default => true
c.add_option :use_transactional_fixtures, :type => :boolean, :default => true
c.add_option :use_instantiated_fixtures, :type => :boolean, :default => false
require 'rspec/rails/example'
(class << c ; self ; end ).class_eval do
include RSpec::Rails::Configuration
end
end
@@ -3,4 +3,3 @@
require 'rspec/rails/example/helper_example_group'
require 'rspec/rails/example/view_example_group'
require 'rspec/rails/example/mailer_example_group'
require 'rspec/rails/example/fixture_example_group'

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,31 @@
module RSpec
module Rails
module FixtureSupport
extend ActiveSupport::Concern
include RSpec::Rails::SetupAndTeardownAdapter
include RSpec::Rails::TestUnitAssertionAdapter
included do
if RSpec.configuration.use_transactional_fixtures
# TODO - figure out how to move this outside the included block
include ActiveRecord::TestFixtures
self.fixture_path = RSpec.configuration.fixture_path
self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures
fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
end
end
end
end
end
RSpec.configure do |c|
c.include RSpec::Rails::FixtureSupport
c.add_option :use_transactional_fixtures, :type => :boolean, :default => true
c.add_option :use_transactional_examples, :alias_for => :use_transactional_fixtures
c.add_option :use_instantiated_fixtures, :type => :boolean, :default => false
c.add_option :global_fixtures
c.add_option :fixture_path
end

0 comments on commit b39e5fd

Please sign in to comment.