Sha256: 4168828b2d99ac0b25cecbe4f3debdd2555daeddd90c4b4295dbf443be31115a

Contents?: true

Size: 1.48 KB

Versions: 15

Compression:

Stored size: 1.48 KB

Contents

RSpec.describe Metasploit::Credential::Origin::Session, type: :model do
  it_should_behave_like 'Metasploit::Concern.run'

  context 'associations' do
    it { is_expected.to have_many(:cores).class_name('Metasploit::Credential::Core').dependent(:destroy) }
    it { is_expected.to belong_to(:session).class_name('Mdm::Session') }
  end

  context 'database' do
    context 'columns' do
      it { is_expected.to have_db_column(:post_reference_name).of_type(:text).with_options(null: false) }

      it_should_behave_like 'timestamp database columns'

      context 'foreign keys' do
        it { is_expected.to have_db_column(:session_id).of_type(:integer).with_options(null: false) }
      end
    end

    context 'columns' do
      it { is_expected.to have_db_index([:session_id, :post_reference_name]).unique(true) }
    end
  end

  context 'factories' do
    context 'metasploit_credential_origin_session' do


      subject(:metasploit_credential_origin_session) do
        FactoryGirl.build(:metasploit_credential_origin_session)
      end

      it { is_expected.to be_valid }
    end
  end

  context 'validations' do
    context 'post_reference_name' do


      before(:example) do
        FactoryGirl.create(:metasploit_credential_origin_session)
      end

      it { is_expected.to validate_presence_of :post_reference_name }
      it { is_expected.to validate_uniqueness_of(:post_reference_name).scoped_to(:session_id) }
    end

    it { is_expected.to validate_presence_of :session }
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
metasploit-credential-2.0.14 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.13 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.12 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.11 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.10 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.9 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.8 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.7 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.6 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.5 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.4 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.3 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.2 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.1 spec/models/metasploit/credential/origin/session_spec.rb
metasploit-credential-2.0.0 spec/models/metasploit/credential/origin/session_spec.rb