Sha256: 88c55aa455a4db3789627c1664bfe5b546536b8f6e64636f01547a678d19d89f

Contents?: true

Size: 781 Bytes

Versions: 1

Compression:

Stored size: 781 Bytes

Contents

module Connections
  def self.extended(host)
    host.establish_connection :adapter => 'sqlite3',
                              :database => ':memory:'

    host.connection.execute <<-eosql
      CREATE TABLE #{host.table_name} (
        #{host.primary_key} integer PRIMARY KEY AUTOINCREMENT
      )
    eosql
  end
end

class NonActiveRecordModel
  extend ActiveModel::Naming
  include ActiveModel::Conversion
end

class MockableModel < ActiveRecord::Base
  extend Connections
  has_one :associated_model
end

class SubMockableModel < MockableModel
end

class AssociatedModel < ActiveRecord::Base
  extend Connections
  belongs_to :mockable_model
end

class AlternatePrimaryKeyModel < ActiveRecord::Base
  self.primary_key = :my_id
  extend Connections
  attr_accessor :my_id
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-rails-2.5.0 spec/rspec/rails/mocks/ar_classes.rb