Sha256: 1171be1098c6ef0d18b3af42821f7246b456788eef83012716f8e27775996a94

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

require 'test_helper'

class OnBaseTest < SecondBase::TestCase

  setup do
    run_db :create
    run_db :migrate
    establish_connection
  end

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

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


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
secondbase-1.0.1 test/cases/on_base_test.rb
secondbase-1.0.0 test/cases/on_base_test.rb