jpignata/temping — Issue #1: ActiveRecord connection problem
Author: pivotal-tabernash
Created: 2012-02-10 15:34:52+00:00
State: open

Hi John,

we've been using Temping for our specs and ran into an issue this morning.

This is our spec files state:

a_using_only_temping_spec.rb
b_using_only_temping_spec.rb
c_using_app_models_spec.rb

Spec b has this Temping setup:

Temping.create :to_be_deleted do
include SoftDeletable
with_columns do |t|
t.boolean :deleted
t.timestamps
end
end

Specs b fails with

SQLite3::SQLException: no such column: true: SELECT COUNT(*) FROM "to_be_deleteds" WHERE (to_be_deleteds.deleted is not true)

Specs c fails with

SQLite3::SQLException: no such table: : DELETE FROM ""

The fix was to force Temping not to use sqlite. In our spec_helper we now have:

Temping.class_eval do
# Force temping not to use its own connection, but use the Rails connection
def self.connect
ActiveRecord::Base.establish_connection
end
end