Sha256: 54967107be2d2a51843e90106ccfef85f42776e1ab5bd9ef0b38ad7702ff2cdd

Contents?: true

Size: 955 Bytes

Versions: 16

Compression:

Stored size: 955 Bytes

Contents

shared_examples_for 'MetasploitDataModels::Search::Visitor::Relation#visit matching record' do |options={}|
  options.assert_valid_keys(:attribute, :association)

  attribute = options.fetch(:attribute)
  association = options[:association]

  if association
    formatted_operator = "#{association}.#{attribute}"
  else
    formatted_operator = attribute.to_s
  end

  context "with #{formatted_operator}" do
    let(:formatted) do
      "#{formatted_operator}:\"#{value}\""
    end

    if association
      let(:associated) do
        # wrap in array so single and plural associations can be handled the same.
        Array.wrap(matching_record.send(association)).first
      end

      let(:value) do
        associated.send(attribute)
      end
    else
      let(:value) do
        matching_record.send(attribute)
      end
    end

    it 'should find only matching record' do
      expect(visit).to match_array([matching_record])
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
metasploit_data_models-0.19.3-java spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.19.3 spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.19.0 spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.19.0-java spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.18.1-java spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.18.1 spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.18.0 spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.18.0-java spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.18.0.pre.compatibility spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.17.3-java spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.17.3 spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.17.3.pre.metasploit.pre.concern-java spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.17.3.pre.metasploit.pre.concern spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.17.2-java spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.17.2 spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb
metasploit_data_models-0.17.2.pre.metasploit.pre.data.pre.models.pre.search spec/support/shared/examples/metasploit_data_models/search/visitor/relation/visit/matching_record.rb