Sha256: 933b285c57f41d45cce37349a48384971758392627749ff899daada08987058d

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 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()
      allow(Rails).to receive(:root).and_return("")
      expect(Dir).to 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

1 entries across 1 versions & 1 rubygems

Version Path
couchrest_model-2.2.0.beta1 spec/unit/utils/migrate_spec.rb