Sha256: 56d4e061d63c897022d01937cf63e20276d8eb00f80cc3a2371b5e4f86e44cde

Contents?: true

Size: 1.55 KB

Versions: 38

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

describe Metasploit::Model::Search::Operation::Null 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(:each) 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
            errors.should_not 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
            errors.should include(error)
          end

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

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
metasploit-model-1.0.0.pre.rails.pre.4.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.30.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.30.0-java spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.29.2 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.29.2-java spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.29.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.29.0-java spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.28.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.28.0-java spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.4 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.4-java spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.3 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.3-java spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.2 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.2-java spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.1 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.1-java spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.0 spec/app/models/metasploit/model/search/operation/null_spec.rb
metasploit-model-0.27.0-java spec/app/models/metasploit/model/search/operation/null_spec.rb