Sha256: d6708cd04c3ecb3c6c6dec3bbebf760745edeca2f6356a850bc8fb555f162dc4

Contents?: true

Size: 1019 Bytes

Versions: 53

Compression:

Stored size: 1019 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?(ActiveRecord::Base) && defined?(::RSpec::Mocks) && (::RSpec::Mocks.respond_to?(:configuration))
            ::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

53 entries across 50 versions & 7 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/rspec-rails-7.1.0/lib/rspec/rails/active_record.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/rspec-rails-7.1.0/lib/rspec/rails/active_record.rb
rspec-rails-7.1.0 lib/rspec/rails/active_record.rb
rspec-rails-7.0.2 lib/rspec/rails/active_record.rb
rspec-rails-7.0.1 lib/rspec/rails/active_record.rb
rspec-rails-7.0.0 lib/rspec/rails/active_record.rb
rspec-rails-6.1.5 lib/rspec/rails/active_record.rb
rspec-rails-6.1.4 lib/rspec/rails/active_record.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rspec-rails-6.1.3/lib/rspec/rails/active_record.rb
rspec-rails-6.1.3 lib/rspec/rails/active_record.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/rspec-rails-6.0.4/lib/rspec/rails/active_record.rb
rspec-rails-6.1.2 lib/rspec/rails/active_record.rb
rspec-rails-6.1.1 lib/rspec/rails/active_record.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rspec-rails-5.1.1/lib/rspec/rails/active_record.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rspec-rails-5.1.2/lib/rspec/rails/active_record.rb
rspec-rails-6.1.0 lib/rspec/rails/active_record.rb
rspec-rails-6.0.4 lib/rspec/rails/active_record.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rspec-rails-5.1.1/lib/rspec/rails/active_record.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rspec-rails-5.1.2/lib/rspec/rails/active_record.rb
rspec-rails-6.0.3 lib/rspec/rails/active_record.rb