Sha256: 9220f9a63e168e072c7726604af161a7fbe3f42f189c3327a8d612bfb6343f3e

Contents?: true

Size: 1.43 KB

Versions: 15

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

RSpec.shared_examples 'API Subjects' do
  context 'AAF shared implementation' do
    subject { build :api_subject }

    it { is_expected.to be_valid }
    it { is_expected.to be_an(Accession::Principal) }
    it { is_expected.to respond_to(:roles) }
    it { is_expected.to respond_to(:permissions) }
    it { is_expected.to respond_to(:permits?) }
    it { is_expected.to respond_to(:functioning?) }

    it 'is invalid without an x509_cn' do
      subject.x509_cn = nil
      expect(subject).not_to be_valid
    end
    it 'is invalid if an x509 value is not in the correct format' do
      subject.x509_cn += '%^%&*'
      expect(subject).not_to be_valid
    end
    it 'is valid if an x509 value is in the correct format' do
      expect(subject).to be_valid
    end
    it 'is invalid if an x509 value is not unique' do
      create(:api_subject, x509_cn: subject.x509_cn)
      expect(subject).not_to be_valid
    end
    it 'is invalid without a description' do
      subject.description = nil
      expect(subject).not_to be_valid
    end
    it 'is invalid without a contact name' do
      subject.contact_name = nil
      expect(subject).not_to be_valid
    end
    it 'is invalid without a contact mail address' do
      subject.contact_mail = nil
      expect(subject).not_to be_valid
    end
    it 'is invalid without an enabled state' do
      subject.enabled = nil
      expect(subject).not_to be_valid
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
aaf-gumboot-2.6.3 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.6.2 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.6.1 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.6.0 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.5.1 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.5.0 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.4.0 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.2.0 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.1.4 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.1.3 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.1.1 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.1.0 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-2.0.1 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-1.2.0 lib/gumboot/shared_examples/api_subjects.rb
aaf-gumboot-1.1.0 lib/gumboot/shared_examples/api_subjects.rb