Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 39 lines (35 sloc) 1.541 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
module RSpec
  module Rails
    if defined?(ActiveRecord::TestFixtures)
      module FixtureSupport
        extend ActiveSupport::Concern
        include RSpec::Rails::SetupAndTeardownAdapter
        include RSpec::Rails::TestUnitAssertionAdapter
        include ActiveRecord::TestFixtures

        included do
          # TODO (DC 2011-06-25) this is necessary because fixture_file_upload
          # accesses fixture_path directly on ActiveSupport::TestCase. This is
          # fixed in rails by https://github.com/rails/rails/pull/1861, which
          # should be part of the 3.1 release, at which point we can include
          # these lines for rails < 3.1.
          ActiveSupport::TestCase.class_eval do
            include ActiveRecord::TestFixtures
            self.fixture_path = RSpec.configuration.fixture_path
          end
          # /TODO

          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

      RSpec.configure do |c|
        c.include RSpec::Rails::FixtureSupport
        c.add_setting :use_transactional_fixtures, :alias_with => :use_transactional_examples
        c.add_setting :use_instantiated_fixtures
        c.add_setting :global_fixtures
        c.add_setting :fixture_path
      end
    end
  end
end
Something went wrong with that request. Please try again.