Sha256: e7bbd8c0a17e6f2d0a3110d88120b929a28d5862830be0163df304ad8fe4c733

Contents?: true

Size: 939 Bytes

Versions: 14

Compression:

Stored size: 939 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|
              target = possible_model.target

              if Class === target && ActiveRecord::Base > target && !target.abstract_class?
                target.define_attribute_methods
              end
            end
          end
        end
      end

      initialize_activerecord_configuration RSpec.configuration
    end
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
rspec-rails-3.5.0.beta4 lib/rspec/rails/active_record.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rspec-rails-3.4.2/lib/rspec/rails/active_record.rb
rspec-rails-3.5.0.beta3 lib/rspec/rails/active_record.rb
rspec-rails-3.5.0.beta2 lib/rspec/rails/active_record.rb
rspec-rails-3.5.0.beta1 lib/rspec/rails/active_record.rb
rspec-rails-3.4.2 lib/rspec/rails/active_record.rb
rspec-rails-3.4.1 lib/rspec/rails/active_record.rb
rspec-rails-3.4.0 lib/rspec/rails/active_record.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/rspec-rails-3.3.3/lib/rspec/rails/active_record.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/rspec-rails-3.3.2/lib/rspec/rails/active_record.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/rspec-rails-3.3.2/lib/rspec/rails/active_record.rb
rspec-rails-3.3.3 lib/rspec/rails/active_record.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/rspec-rails-3.3.2/lib/rspec/rails/active_record.rb
rspec-rails-3.3.2 lib/rspec/rails/active_record.rb