Sha256: d15a68edd76e4759ce3a2e424d68a395625973d54b4b69936df857abe0c9adb4
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'spec_helper' module Plutus describe Account do describe 'tenancy support' do before(:each) do ActiveSupportHelpers.clear_model('Account') ActiveSupportHelpers.clear_model('Asset') Plutus.enable_tenancy = true Plutus.tenant_class = 'Plutus::Entry' FactoryGirlHelpers.reload() Plutus::Asset.new end after(:each) do if Plutus.const_defined?(:Asset) ActiveSupportHelpers.clear_model('Account') ActiveSupportHelpers.clear_model('Asset') end Plutus.enable_tenancy = false Plutus.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
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
odania_plutus-0.13 | spec/models/tenancy_spec.rb |
plutus-0.13 | spec/models/tenancy_spec.rb |