metasploit_data_models 0.14.3 → 0.14.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.14.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -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
@@ -396,7 +396,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
396
396
  version: '0'
397
397
  segments:
398
398
  - 0
399
- hash: -614166004821636482
399
+ hash: -1794950276637032896
400
400
  required_rubygems_version: !ruby/object:Gem::Requirement
401
401
  none: false
402
402
  requirements:
@@ -405,7 +405,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
405
405
  version: '0'
406
406
  segments:
407
407
  - 0
408
- hash: -614166004821636482
408
+ hash: -1794950276637032896
409
409
  requirements: []
410
410
  rubyforge_project:
411
411
  rubygems_version: 1.8.25