Sha256: a66d5a305336b123f2f6f40c9c7fb83910e1094059f8290052340a66e712cfbb

Contents?: true

Size: 731 Bytes

Versions: 5

Compression:

Stored size: 731 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) + '/../rails/reload_classes'

class Autoloader
  def self.const_missing(name)
    eval("#{name} = Class.new; #{name}.send(:include, CouchPotato::Persistence)")
  end
end


describe CouchPotato::Database, 'rails specific behavior' do
  
  it "should load load models whose constants are currently uninitialized (like with rails in development mode)" do
    Autoloader::Uninitialized
    Autoloader.send :remove_const, 'Uninitialized'
    recreate_db
    CouchPotato.couchrest_database.save_doc(JSON.create_id => 'Autoloader::Uninitialized', '_id' => '1')
    CouchPotato.database.load('1').class.name.should == 'Autoloader::Uninitialized'
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
couch_potato-0.2.20 spec/rails_spec.rb
couch_potato-0.2.19 spec/rails_spec.rb
couch_potato-0.2.18 spec/rails_spec.rb
couch_potato-0.2.17 spec/rails_spec.rb
couch_potato-0.2.16 spec/rails_spec.rb