Sha256: 9e5c1149235ab7b36f6fbb67180e104a92cb9d4d599cd4b4b37af445d3ac0626

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 KB

Contents

shared_examples_for 'search query with Metasploit::Model::Search::Operator::Deprecated::Authority' do |options={}|
  options.assert_valid_keys(:formatted_operator)

  formatted_operator = options.fetch(:formatted_operator)

  context "with #{formatted_operator}" do
    subject(:query) do
      Metasploit::Model::Search::Query.new(
          :formatted => formatted,
          :klass => base_class
      )
    end

    let(:formatted) do
      "#{formatted_operator}:\"#{formatted_value}\""
    end

    let(:formatted_value) do
      FactoryGirl.generate :metasploit_model_reference_designation
    end

    context 'operations' do
      subject(:operations) do
        query.operations
      end

      def operation_with_formatted_operator(formatted_operator)
        operator_name = formatted_operator.to_sym

        operations.find { |operation|
          operation.operator.name == operator_name
        }
      end

      context 'authoritities.abbreviation' do
        subject(:operation) do
          operation_with_formatted_operator('authorities.abbreviation')
        end

        its(:value) { should == formatted_operator }
      end

      context 'references.designation' do
        subject(:operation) do
          operation_with_formatted_operator('references.designation')
        end

        context 'value' do
          subject(:value) do
            operation.value
          end

          it 'should be formatted value' do
            value.should == formatted_value
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
metasploit-model-0.25.7 spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.7-java spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.6 spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.6-java spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.3 spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.3-java spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.2 spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.2-java spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.1 spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.1-java spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups-java spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.25.1.pre.metasploit.pre.model.pre.search.pre.operator.pre.and.pre.operation.pre.groups spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.24.1-java spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.24.1 spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb
metasploit-model-0.24.1.pre.semantic.pre.versioning.pre.2.pre.0 spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb