Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 17816d29ec
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (40 sloc) 0.963 kB
module NoConnections
def self.included(mod)
(class << mod; self; end).class_eval do
def columns
[]
end
def connection
RSpec::Mocks::Mock.new.as_null_object
end
end
end
end
class NonActiveRecordModel
extend ActiveModel::Naming
include ActiveModel::Conversion
end
class MockableModel < ActiveRecord::Base
include NoConnections
has_one :associated_model
end
class SubMockableModel < MockableModel
end
class AssociatedModel < ActiveRecord::Base
include NoConnections
belongs_to :mockable_model
end
class AlternatePrimaryKeyModel < ActiveRecord::Base
include NoConnections
self.primary_key = :my_id
attr_accessor :my_id
end
class ConnectableModel < ActiveRecord::Base
establish_connection :adapter => 'sqlite3',
:database => ':memory:'
connection.execute <<-eosql
CREATE TABLE connectable_models (
id integer PRIMARY KEY AUTOINCREMENT
)
eosql
end
Jump to Line
Something went wrong with that request. Please try again.