Sha256: c0c0ca0afab5ec521426ff718d89fc6583c76e55109cf7574ab36a59a9984ead

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Combustion
  describe Database do
    before(:all) do
      Dir.chdir(File.expand_path("dummy", __dir__)) do
        Combustion.initialize! :active_record
      end
    end

    it "creates dummy table from migration in base database" do
      expect(Model.connection.table_exists?("dummy_table")).to eq true
      expect(Model.connection.table_exists?("dummy_in_another_db")).to eq false
    end

    it "creates another dummy table from another database" do
      expect(ModelInAnotherDb.connection.table_exists?("dummy_table")).
        to eq false
      expect(ModelInAnotherDb.connection.table_exists?("dummy_in_another_db")).
        to eq true
    end

    it "returns test database for model with default connection" do
      expect(Model.connection_config[:database]).to match(/test/)
    end

    it "returns test_another for model with connection to second database" do
      expect(ModelInAnotherDb.connection_config[:database]).
        to match(/test_another/)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
combustion-1.1.2 spec/database_spec.rb
combustion-1.1.1 spec/database_spec.rb
combustion-1.1.0 spec/database_spec.rb
combustion-1.0.0 spec/database_spec.rb
combustion-0.9.1 spec/database_spec.rb