Sha256: cdda5ed38bdf7112aa83c62cb2f3e88b869727a9d34bfead2050d96a31b16d31

Contents?: true

Size: 1.56 KB

Versions: 22

Compression:

Stored size: 1.56 KB

Contents

RSpec.describe Metasploit::Model::Search::Operation::Null, type: :model do
  context 'validation' do
    context 'operator' do
      context 'null' do
        let(:error) do
          I18n.translate(
              'metasploit.model.errors.models.metasploit/model/search/operation/null.attributes.operator.type',
              type: Metasploit::Model::Search::Operator::Null
          )
        end

        let(:errors) do
          operation.errors[:operator]
        end

        let(:klass) do
          Class.new
        end

        let(:operation) do
          described_class.new(
              :operator => operator
          )
        end

        let(:operator) do
          operator_class.new(
              :klass => klass
          )
        end

        before(:example) do
          operation.valid?
        end

        context 'with Metasploit::Model::Search::Operator::Null' do
          let(:operator_class) do
            Metasploit::Model::Search::Operator::Null
          end

          it 'should not record error' do
            expect(errors).not_to include(error)
          end
        end

        context 'without Metasploit::Model::Search::Operator::Null' do
          let(:operator_class) do
            Metasploit::Model::Search::Operator::Base
          end

          it 'should record error' do
            expect(errors).to include(error)
          end

          it 'should have no other errors, so that it would be valid without this type check on operator' do
            expect(operation.errors.size).to eq(1)
          end
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
metasploit-model-5.0.2 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-5.0.1 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-5.0.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-4.0.6 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-4.0.5 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-4.0.4 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-4.0.3 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-4.0.2 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-4.0.1 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-4.0.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-3.1.4 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-3.1.3 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-3.1.2 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-3.1.1 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-3.1.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-3.0.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-2.0.4 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-2.0.3 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-2.0.2 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-2.0.1 spec/app/models/metasploit/model/search/operation/null_spec.rb