Sha256: beba0ac43888c72120bebc3243e537c3b8ba0d1848e500848bbbd28c6e7999de

Contents?: true

Size: 833 Bytes

Versions: 4

Compression:

Stored size: 833 Bytes

Contents

require "test_helper"

class RoomerTest < ActiveSupport::TestCase

  test 'setup block yeilds self' do
    Roomer.setup do |config|
      assert_equal Roomer, config
    end
  end

  test 'return migrations directory' do
    assert_equal Roomer.tenanted_migrations_directory, "db/migrate"
    Roomer.use_tenanted_migrations_directory = true
    assert_equal Roomer.tenanted_migrations_directory, "db/migrate/tenants"
  end


  test 'set the current tenant' do
    tenant1 = mock()
    tenant2 = mock()

    assert_not_equal(tenant1,tenant2)

    thread1 = Thread.new do
      Roomer.current_tenant = tenant1
      sleep 1
      assert_equal(Roomer.current_tenant,tenant1)
    end

    thread2 = Thread.new do
      Roomer.current_tenant = tenant2
      assert_equal(Roomer.current_tenant,tenant2)
    end

    thread2.join
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roomer-0.0.11 test/roomer/roomer_test.rb
roomer-0.0.10 test/roomer/roomer_test.rb
roomer-0.0.9 test/roomer/roomer_test.rb
roomer-0.0.8 test/roomer/roomer_test.rb