Sha256: d3cca38f11663fdead0562885727a239f2bd0b7d97ead50cc74adb30516aa3aa

Contents?: true

Size: 860 Bytes

Versions: 5

Compression:

Stored size: 860 Bytes

Contents

module RSpec
  module Rails
    # Fake class to document RSpec ActiveRecord configuration options. In practice,
    # these are dynamically added to the normal RSpec configuration object.
    class ActiveRecordConfiguration
      # @private
      def self.initialize_activerecord_configuration(config)
        config.before :suite do
          # This allows dynamic columns etc to be used on ActiveRecord models when creating instance_doubles
          if defined?(ActiveRecord) && defined?(::RSpec::Mocks)
            ::RSpec::Mocks.configuration.when_declaring_verifying_double do |possible_model|
              possible_model.target.define_attribute_methods if possible_model.target.respond_to?(:define_attribute_methods)
            end
          end
        end
      end

      initialize_activerecord_configuration RSpec.configuration
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-rails-3.3.0 lib/rspec/rails/active_record.rb
rspec-rails-3.2.3 lib/rspec/rails/active_record.rb
rspec-rails-3.2.2 lib/rspec/rails/active_record.rb
rspec-rails-3.2.1 lib/rspec/rails/active_record.rb
rspec-rails-3.2.0 lib/rspec/rails/active_record.rb