Sha256: feac54aa54d5713d788c763c9293e98d039cd2e50d403b81deddbf7bec2efe9a
Contents?: true
Size: 1.95 KB
Versions: 1
Compression:
Stored size: 1.95 KB
Contents
require 'spec_helper' describe G5Updatable::Client do describe "validations" do subject(:client) { G5Updatable::Client.new } it { expect(client).to validate_presence_of(:uid) } it { expect(client).to validate_presence_of(:urn) } it { expect(client).to validate_uniqueness_of(:urn) } it { expect(client).to have_many :locations } end it_behaves_like "a model with first-class properties" do let(:instance_factory_name) { :client } end it_behaves_like "a model that uses its URN as its parameter" do let(:instance_factory_name) { :client } end describe :locations do let!(:location) { create(:location, client_uid: subject.uid) } subject { create(:client) } its(:locations) { is_expected.to eq([location]) } end describe '#centralized_cls?' do subject { build(:client, properties: { centralized_cls_url: centralized_cls_url }) } context 'nil centralized_cls_url' do let(:centralized_cls_url) { nil } its(:centralized_cls?) { is_expected.to be_falsey } end context 'blank centralized_cls_url' do let(:centralized_cls_url) { ' ' } its(:centralized_cls?) { is_expected.to be_falsey } end context 'present centralized_cls_url' do let(:centralized_cls_url) { 'https://a-centralized-cls.com' } its(:centralized_cls?) { is_expected.to be_truthy } end end describe '#centralized_cms?' do subject { build(:client, properties: { centralized_cms_url: centralized_cms_url }) } context 'nil centralized_cms_url' do let(:centralized_cms_url) { nil } its(:centralized_cms?) { is_expected.to be_falsey } end context 'blank centralized_cms_url' do let(:centralized_cms_url) { ' ' } its(:centralized_cms?) { is_expected.to be_falsey } end context 'present centralized_cms_url' do let(:centralized_cms_url) { 'https://a-centralized-cms.com' } its(:centralized_cms?) { is_expected.to be_truthy } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
g5_updatable-1.0.2.pre.1 | spec/models/g5_updatable/client_spec.rb |