Sha256: 116c4e8b314c32e3fcc87ff966708f3b375f9b19fd94bd7ed2f82c589439947d
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require 'spec_helper' module Credere describe Account do describe 'tenancy support' do before(:each) do ActiveSupportHelpers.clear_model('Account') ActiveSupportHelpers.clear_model('Asset') Credere.enable_tenancy = true Credere.tenant_class = 'Credere::Entry' FactoryGirlHelpers.reload() Credere::Asset.new end after(:each) do if Credere.const_defined?(:Asset) ActiveSupportHelpers.clear_model('Account') ActiveSupportHelpers.clear_model('Asset') end Credere.enable_tenancy = false Credere.tenant_class = nil FactoryGirlHelpers.reload() end it 'validate uniqueness of name scoped to tenant' do account = FactoryGirl.create(:asset, tenant_id: 10) record = FactoryGirl.build(:asset, name: account.name, tenant_id: 10) expect(record).not_to be_valid expect(record.errors[:name]).to eq(['has already been taken']) end it 'allows same name scoped under a different tenant' do account = FactoryGirl.create(:asset, tenant_id: 10) record = FactoryGirl.build(:asset, name: account.name, tenant_id: 11) expect(record).to be_valid end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
credere-0.10.3 | spec/models/tenancy_spec.rb |
credere-0.10.2 | spec/models/tenancy_spec.rb |
credere-0.10.1 | spec/models/tenancy_spec.rb |