Sha256: 684f526fec718ef134294add82625490d027d5bd681588d110839742aac1b63f

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Alvid do
  it 'has a version number' do
    expect(Alvid::VERSION).not_to be nil
  end

  describe 'init' do
    describe 'when VCAP_SERVICES provided' do
      it 'uses provided db' do
        ENV["VCAP_SERVICES"] = '{ "p-mysql-n/a": [ { "credentials": { "uri":"cool-mysql-uri" }, "label": "p-mysql-n/a", "name": "p-mysql", "syslog_drain_url": "", "tags": ["postgres","postgresql","relational"] } ] } '
        expect(DataMapper).to receive(:setup).with(:default, "cool-mysql-uri")
        Alvid.init
        ENV.clear
      end
    end

    describe 'when VCAP_SERVICES is empty' do
      it 'uses provided db' do
        ENV["VCAP_SERVICES"] = '{  }'
        expect(DataMapper).to receive(:setup).with(:default, 'sqlite::memory:')
        Alvid.init
        ENV.clear
      end
    end

    describe "when VCAP_SERVICES is not provided" do
      it "uses inmemory db" do
        ENV.clear
        expect(DataMapper).to receive(:setup).with(:default, 'sqlite::memory:')
        Alvid.init
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alvid-0.1.0 spec/alvid_spec.rb