Sha256: df7f9d0792f15a35527e0051d7a844a0b2968f79f1694d7fad8edad501a0cd18
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 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) record.should_not be_valid record.errors[:name].should == ['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) record.should be_valid end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
plutus-0.12.2 | spec/models/tenancy_spec.rb |
plutus-0.11.0 | spec/models/tenancy_spec.rb |
plutus-0.10.1 | spec/models/tenancy_spec.rb |
plutus-0.10.0 | spec/models/tenancy_spec.rb |