Sha256: ccc4e7da3daf92880abc67ef7a0230c9e279060f39955e4aff89d82e6cb51729
Contents?: true
Size: 1.5 KB
Versions: 27
Compression:
Stored size: 1.5 KB
Contents
require 'rails_helper' module PandaPal RSpec.describe Organization, type: :model do it 'creates a schema upon creation' do expect(Apartment::Tenant).to receive(:create) create :panda_pal_organization end it 'deletes a schema upon deletion' do expect(Apartment::Tenant).to receive(:create) expect(Apartment::Tenant).to receive(:drop) org = create :panda_pal_organization org.destroy end it 'does not allow the name to be changed after creation' do org = create :panda_pal_organization org.name = 'test123' expect(org.valid?).to be_falsey end it 'requires a salesforce_id' do org = build :panda_pal_organization, salesforce_id: nil expect(org.valid?).to be_falsey end it 'does not allow duplicate salesforce ids' do org = create :panda_pal_organization, salesforce_id: 'salesforce' org2 = build :panda_pal_organization, salesforce_id: 'salesforce' expect(org2.valid?).to be_falsey end it 'stores setting as an indifferent Hash' do org = create :panda_pal_organization org.update!(settings: { a: 1 }) expect(Organization.last.settings).to be_a (ActiveSupport::HashWithIndifferentAccess) org.settings = {} expect(org.settings).to be_a (ActiveSupport::HashWithIndifferentAccess) end it 'stores settings' do org = create :panda_pal_organization org.update!(settings: { a: 1 }) expect(Organization.last.settings[:a]).to eql(1) end end end
Version data entries
27 entries across 27 versions & 1 rubygems