Sha256: 796039447c805a2d3248fc897e62286f854995b14383b5b5135f4ac3001b59c9

Contents?: true

Size: 645 Bytes

Versions: 4

Compression:

Stored size: 645 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 = mock()
      Rails.stub!(:root).and_return("")
      Dir.should_receive(:[]).with("app/models/**/*.rb").and_return(['failed_require'])
      # we can't mock require, so just expect an error
      expect {
        @module.load_all_models
      }.to raise_error(LoadError)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
couchrest_model-2.0.4 spec/unit/utils/migrate_spec.rb
couchrest_model-2.0.3 spec/unit/utils/migrate_spec.rb
couchrest_model-2.0.1 spec/unit/utils/migrate_spec.rb
couchrest_model-2.0.0 spec/unit/utils/migrate_spec.rb