Sha256: 10e68a17449a9e9651318dbb21c3ae7859f25e5c5e9b518aba4fb1757b43ec20

Contents?: true

Size: 769 Bytes

Versions: 6

Compression:

Stored size: 769 Bytes

Contents

ActiveRecord::Base.establish_connection(
  :adapter => 'sqlite3',
  :database => ':memory:'
)

module Connections
  def self.extended(host)

    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

6 entries across 6 versions & 1 rubygems

Version Path
rspec-rails-2.6.1 spec/rspec/rails/mocks/ar_classes.rb
rspec-rails-2.6.1.beta1 spec/rspec/rails/mocks/ar_classes.rb
rspec-rails-2.6.0 spec/rspec/rails/mocks/ar_classes.rb
rspec-rails-2.6.0.rc6 spec/rspec/rails/mocks/ar_classes.rb
rspec-rails-2.6.0.rc4 spec/rspec/rails/mocks/ar_classes.rb
rspec-rails-2.6.0.rc2 spec/rspec/rails/mocks/ar_classes.rb