metasploit_data_models 0.14.3-java → 0.14.4-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -382,7 +382,7 @@ class Mdm::Host < ActiveRecord::Base
382
382
  lambda { |*args|
383
383
  # @todo replace with AREL
384
384
  terms = SEARCH_FIELDS.collect { |field|
385
- "#{field} ILIKE ?"
385
+ "#{self.table_name}.#{field} ILIKE ?"
386
386
  }
387
387
  disjunction = terms.join(' OR ')
388
388
  formatted_parameter = "%#{args[0]}%"
@@ -4,5 +4,5 @@ module MetasploitDataModels
4
4
  # metasploit-framework/data/sql/migrate to db/migrate in this project, not all models have specs that verify the
5
5
  # migrations (with have_db_column and have_db_index) and certain models may not be shared between metasploit-framework
6
6
  # and pro, so models may be removed in the future. Because of the unstable API the version should remain below 1.0.0
7
- VERSION = '0.14.3'
7
+ VERSION = '0.14.4'
8
8
  end
@@ -391,4 +391,26 @@ describe Mdm::Host do
391
391
  it { should ensure_inclusion_of(:state).in_array(states).allow_nil }
392
392
  it { should validate_presence_of(:workspace) }
393
393
  end
394
+
395
+ context 'search scope' do
396
+ subject(:full_mdm_host) do
397
+ FactoryGirl.create(:full_mdm_host)
398
+ end
399
+
400
+ def search_for(str)
401
+ Mdm::Host.search(str)
402
+ end
403
+
404
+ context 'searching for an empty string' do
405
+ it 'should return any hosts in the database' do
406
+ search_for('').should include(subject)
407
+ end
408
+ end
409
+
410
+ context 'searching for an existing Host\'s name' do
411
+ it 'should return the host' do
412
+ search_for(subject.name).should include(subject)
413
+ end
414
+ end
415
+ end
394
416
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: metasploit_data_models
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.14.3
5
+ version: 0.14.4
6
6
  platform: java
7
7
  authors:
8
8
  - Samuel Huckins
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-05-17 00:00:00.000000000 Z
15
+ date: 2013-05-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake