Sha256: d0622c3608021598d3b2cb3b9ecefd9d281f1bf03cdca0eae6527e1dbaac0743

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

utils = Ferry::Utilities.new

Dir.chdir("spec") unless Dir.pwd.split('/').last == "spec"

describe("utility functions") do
	describe "#db_connect" do

  		it "#sqlite3" do
  			expect{utils.db_connect("sqlite3")}.not_to raise_error
        expect(ActiveRecord::Base.connection.adapter_name).to eql('SQLite')
    	end

      it "#postgresql" do
        expect{utils.db_connect("postgresql")}.not_to raise_error
        expect(ActiveRecord::Base.connection.adapter_name).to eql('PostgreSQL')
      end

      it "#postgresql fails if system user name is not role in PostgreSQL" do
        expect{utils.db_connect("postgresql_system_user_name")}.not_to raise_error
        expect{ActiveRecord::Base.connection.adapter_name}.not_to raise_error
      end

      it "#mysql2" do
        expect{utils.db_connect("mysql2")}.not_to raise_error
        expect(ActiveRecord::Base.connection.adapter_name).to eql('Mysql2')
      end

      it "#no environment with given name" do
        expect{utils.db_connect("invalid_env")}.to raise_error
      end

      it "#unsupported DB type" do
        expect{utils.db_connect("oracle")}.to raise_error
      end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ferry-2.0.0 spec/tests/utilities_tests.rb
ferry-1.3.3 spec/tests/utilities_tests.rb
ferry-1.3.2 spec/tests/utilities_tests.rb
ferry-1.3.1 spec/tests/utilities_tests.rb
ferry-1.3.0 spec/tests/utilities_tests.rb
ferry-1.2.1 spec/tests/utilities_tests.rb
ferry-1.2.0 spec/tests/utilities_tests.rb
ferry-1.1.1 spec/tests/utilities_tests.rb
ferry-1.1.0 spec/tests/utilities_tests.rb