Sha256: ad514c8240d56c4a8dcb71d4041d34a7db7db259dadc8cafa5ad3e91f0f04949

Contents?: true

Size: 870 Bytes

Versions: 2

Compression:

Stored size: 870 Bytes

Contents

require 'test_helper'

class OnBaseTest < ThirdBase::TestCase

  setup do
    run_db :create
    run_db :migrate
    establish_connection
  end

  def test_on_base
    refute ThirdBase.is_on_base
    ThirdBase.on_base do
      assert ThirdBase.is_on_base
      assert_equal ThirdBase::Base.connection.class, ActiveRecord::Base.connection.class
      assert_equal [ThirdBase::Railtie.fullpath('migrate')], ActiveRecord::Tasks::DatabaseTasks.migrations_paths
      assert_equal ThirdBase::Railtie.fullpath, ActiveRecord::Tasks::DatabaseTasks.db_dir
    end
    refute ThirdBase.is_on_base
  end

  def test_on_base_nested
    refute ThirdBase.is_on_base
    ThirdBase.on_base do
      assert ThirdBase.is_on_base
      ThirdBase.on_base do
        assert ThirdBase.is_on_base
      end
      assert ThirdBase.is_on_base
    end
    refute ThirdBase.is_on_base
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thirdbase-2.1.2 test/cases/on_base_test.rb
thirdbase-2.1.1 test/cases/on_base_test.rb