diff --git a/spec/pickle/orm_adapters/active_record_spec.rb b/spec/pickle/orm_adapters/active_record_spec.rb index 37d0cf06..366cbc7f 100644 --- a/spec/pickle/orm_adapters/active_record_spec.rb +++ b/spec/pickle/orm_adapters/active_record_spec.rb @@ -1,19 +1,11 @@ require 'spec_helper' -begin - require 'activerecord' -rescue LoadError - require 'active_record' -rescue LoadError +if !defined?(ActiveRecord::Base) puts "** install activerecord to run the specs in #{__FILE__}" -end - -if defined?(ActiveRecord::Base) +else require 'pickle/orm_adapters/active_record' - # # setup an activerecord db, and classes, specs are below - # database = File.join(File.dirname(__FILE__), '../../../tmp/active_record.sqlite') `mkdir -p #{File.dirname(database)}` @@ -27,7 +19,7 @@ end end - # stick the ActiveRecord classes and specs in a namespace to isolate them from the other specs + # stick the ActiveRecord classes and specs in a namespace to isolate them module ArOrmSpec class User < ActiveRecord::Base belongs_to :site, :class_name => "ArOrmSpec::Site" @@ -47,9 +39,7 @@ class Note < AbstractNoteClass belongs_to :owner, :polymorphic => true end - # # here be the specs! - # describe ActiveRecord::Base::PickleOrmAdapter do before { DatabaseCleaner.clean } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 84550df9..19cf7f02 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,9 @@ require 'rubygems' require 'spec' -require 'active_support' -require 'active_record' $:.unshift(File.dirname(__FILE__) + '/../lib') require 'pickle' -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} \ No newline at end of file +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} + +require 'active_support' diff --git a/spec/support/database.rb b/spec/support/database.rb new file mode 100644 index 00000000..b420c7db --- /dev/null +++ b/spec/support/database.rb @@ -0,0 +1,4 @@ +require 'active_record' +require 'database_cleaner' + +DatabaseCleaner.strategy = :truncation \ No newline at end of file