Sha256: 690fa8061e81ba1a96569dbd907c1207e0250ccbeb6cae22eddccae0097376b9

Contents?: true

Size: 934 Bytes

Versions: 5

Compression:

Stored size: 934 Bytes

Contents

require "test_helper"

describe Vanity::Autoconnect do
  describe ".should_connect?" do
    it "returns true by default" do
      autoconnect = Vanity::Autoconnect.should_connect?
      assert autoconnect == true
    end

    it "returns false if environment flag is set" do
      ENV['VANITY_DISABLED'] = '1'
      autoconnect = Vanity::Autoconnect.should_connect?
      assert autoconnect == false
      ENV['VANITY_DISABLED'] = nil
    end

    it "returns false if in assets:precompile rake task" do
      Rake.expects(:application).returns(stub(top_level_tasks: ['assets:precompile']))
      autoconnect = Vanity::Autoconnect.should_connect?
      assert autoconnect == false
    end
  end

  describe ".schema_relevant?" do
    it "returns true for database tasks" do
      Rake.expects(:application).returns(stub(top_level_tasks: ['db:migrate']))
      assert_equal true, Vanity::Autoconnect.schema_relevant?
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vanity-4.0.4 test/autoconnect_test.rb
vanity-4.0.3 test/autoconnect_test.rb
vanity-4.0.2 test/autoconnect_test.rb
vanity-4.0.1 test/autoconnect_test.rb
vanity-4.0.0 test/autoconnect_test.rb