Sha256: 635fe831db9db2cdcf9e01db8d0dfd5d4dd02324f2ce0f5a58962be7ebbaab38

Contents?: true

Size: 648 Bytes

Versions: 3

Compression:

Stored size: 648 Bytes

Contents

require 'spec_helper'

describe CouchRest::Model::Utils::Migrate do

  before :each do
    @module = CouchRest::Model::Utils::Migrate
  end

  describe "#load_all_models" do
    it "should not do anything if Rails is not available" do
      @module.load_all_models
    end
    it "should detect if Rails is available and require models" do
      Rails = double()
      Rails.stub(:root).and_return("")
      Dir.should_receive(:[]).with("app/models/**/*.rb").and_return(['failed_require'])
      # we can't double require, so just expect an error
      expect {
        @module.load_all_models
      }.to raise_error(LoadError)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
couchrest_model-2.1.0.rc1 spec/unit/utils/migrate_spec.rb
couchrest_model-2.1.0.beta2 spec/unit/utils/migrate_spec.rb
couchrest_model-2.1.0.beta1 spec/unit/utils/migrate_spec.rb