Sha256: 813c38ec6f2a1a09858f4382025cb5a003a8f5a636a33abd95be181bd1eb9549

Contents?: true

Size: 892 Bytes

Versions: 5

Compression:

Stored size: 892 Bytes

Contents

require 'spec_helper'

describe Mongoid::Tenant do
  it 'should have a tenancy' do
    expect(Journal).to include(Mongoid::Tenancy)
  end

  it 'should not have both modules' do
    expect(Journal).to_not include(Mongoid::Tenant)
  end

  it 'should have a tenant' do
    expect(Article).to include(Mongoid::Tenant)
  end

  it 'should not have both modules' do
    expect(Article).to_not include(Mongoid::Tenancy)
  end

  it 'should not interfer with tenancy' do
    expect do
      Journal.create!(url: 'a_planeta_test', name: 'Planeta Diário')
    end.to_not raise_error
    expect(Journal.count).to eq 1
  end

  it 'should not interfer other models' do
    expect { City.create!(name: 'Sin City') }.to_not raise_error
  end

  it 'should interfer with tenant w/o tenancy' do
    expect { Article.create!(title: 'A Very Nice Coffeeshop') }
      .to raise_error(RuntimeError)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongoid-tenant-0.3.7 spec/mongoid/tenant_spec.rb
mongoid-tenant-0.3.5 spec/mongoid/tenant_spec.rb
mongoid-tenant-0.3.3 spec/mongoid/tenant_spec.rb
mongoid-tenant-0.3.1 spec/mongoid/tenant_spec.rb
mongoid-tenant-0.0.9 spec/mongoid/tenant_spec.rb