Sha256: d6f58145a2b8f44c3d93e9b14d773323c76e8899ee7dcf86adcc58d8fc12af9b

Contents?: true

Size: 958 Bytes

Versions: 4

Compression:

Stored size: 958 Bytes

Contents

require 'spec_helper'

describe Railblazer::AdapterDetection do
  describe "#detect" do
    FauxGemfile = Struct.new(:gems)

    it "should detect mysql" do
      gemfile = FauxGemfile.new(%w[mysql othergem].to_set)
      Railblazer::AdapterDetection.new(gemfile).run.must_equal 'mysql'
    end

    it "should detect postgres" do
      gemfile = FauxGemfile.new(%w[othergem pg].to_set)
      Railblazer::AdapterDetection.new(gemfile).run.must_equal 'postgresql'
    end

    it "should raise an exception when more than one db gem is detected" do
      gemfile = FauxGemfile.new(%w[mysql2 pg].to_set)

      assert_raises RuntimeError do
        Railblazer::AdapterDetection.new(gemfile).run
      end
    end

    it "should raise an exception when there was no db gem detected" do
      gemfile = FauxGemfile.new(%w[thor rails].to_set)

      assert_raises RuntimeError do
        Railblazer::AdapterDetection.new(gemfile).run
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
railblazer-0.0.4 spec/railblazer/adapter_detection_spec.rb
railblazer-0.0.3 spec/railblazer/adapter_detection_spec.rb
railblazer-0.0.2 spec/railblazer/adapter_detection_spec.rb
railblazer-0.0.1 spec/railblazer/adapter_spec.rb