Sha256: 065175f0d1c99fb3659fc7cf248887a876b9b3315546da1f8866d588ed696f35

Contents?: true

Size: 893 Bytes

Versions: 2

Compression:

Stored size: 893 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(NoMethodError)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-tenant-0.0.8 spec/mongoid/tenant_spec.rb
mongoid-tenant-0.0.7 spec/mongoid/tenant_spec.rb