sunspot_matchers 2.1.0.0 → 2.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2b9f2351c5011eeef1815a2cce609aadc5f4559c
4
+ data.tar.gz: d3fbf3dcfe3d888216656b1ed6f2073956e502a4
5
+ SHA512:
6
+ metadata.gz: 7e04803a077016a0f44693b72539c84229b34ff517ab517e09b82223c906d846a645c6eda20459fbcac76435b20c64be584d525a936fad6a55a4a87ef5f3f233
7
+ data.tar.gz: 8ee3308066ab2d47b335b74deb1bb667e3bb11a5749f58d4cb669b1766cb733eabfca49bed0db597ac507c947e5cb1d3f473cafad1e74f514767b15eca175f08
@@ -107,7 +107,7 @@ module SunspotMatchers
107
107
  comparison = [comparison] unless comparison.is_a?(Array)
108
108
  filter_values(comparison).reject do |value|
109
109
  next false unless actual
110
- value_matcher = Regexp.new(Regexp.escape(value))
110
+ value_matcher = Regexp.new("^#{Regexp.escape(value)}")
111
111
  actual.any?{ |actual_value| actual_value =~ value_matcher }
112
112
  end
113
113
  end
@@ -1,37 +1,40 @@
1
1
  require 'sunspot'
2
- require 'test/unit'
3
2
  require File.expand_path('../matchers', __FILE__)
4
3
  require File.expand_path('../sunspot_session_spy', __FILE__)
5
4
  module SunspotMatchers
6
5
  class HaveSearchParamsForSession
6
+ if const_defined? 'MiniTest'
7
+ include MiniTest::Assertions
8
+ else
7
9
  include Test::Unit::Assertions
10
+ end
8
11
 
9
- def initialize(session, method, *args, &block)
10
- @session = session
11
- @method = method
12
- @args = [*args, block].compact
13
- end
12
+ def initialize(session, method, *args, &block)
13
+ @session = session
14
+ @method = method
15
+ @args = [*args, block].compact
16
+ end
14
17
 
15
- def get_matcher
16
- matcher_class = case @method
17
- when :with
18
- WithMatcher
19
- when :without
20
- WithoutMatcher
21
- when :keywords
22
- KeywordsMatcher
23
- when :boost
24
- BoostMatcher
25
- when :facet
26
- FacetMatcher
27
- when :order_by
28
- OrderByMatcher
29
- when :paginate
30
- PaginationMatcher
31
- end
32
- matcher_class.new(@session, @args)
18
+ def get_matcher
19
+ matcher_class = case @method
20
+ when :with
21
+ WithMatcher
22
+ when :without
23
+ WithoutMatcher
24
+ when :keywords, :fulltext
25
+ KeywordsMatcher
26
+ when :boost
27
+ BoostMatcher
28
+ when :facet
29
+ FacetMatcher
30
+ when :order_by
31
+ OrderByMatcher
32
+ when :paginate
33
+ PaginationMatcher
33
34
  end
35
+ matcher_class.new(@session, @args)
34
36
  end
37
+ end
35
38
 
36
39
 
37
40
  class BeASearchForSession
@@ -1,3 +1,3 @@
1
1
  module SunspotMatchers
2
- VERSION = "2.1.0.0"
2
+ VERSION = "2.1.0.1"
3
3
  end
@@ -218,6 +218,14 @@ describe "Sunspot Matchers" do
218
218
  Sunspot.session.should_not have_search_params(:with, :blog_id, any_param)
219
219
  end
220
220
 
221
+ it "should work with any_param negative match when without exists" do
222
+ Sunspot.search(Post) do
223
+ without :blog_id, 4
224
+ without :blog_id, 5
225
+ end
226
+ Sunspot.session.should_not have_search_params(:with, :blog_id, any_param)
227
+ end
228
+
221
229
  it "should work with any_param negative match different field with query" do
222
230
  Sunspot.search(Post) do
223
231
  with :category_ids, 7
@@ -345,6 +353,13 @@ describe "Sunspot Matchers" do
345
353
  Sunspot.session.should_not have_search_params(:without, :blog_id, any_param)
346
354
  end
347
355
 
356
+ it "should work with any_param negative match when with exists" do
357
+ Sunspot.search(Post) do
358
+ with :blog_id, 4
359
+ end
360
+ Sunspot.session.should_not have_search_params(:without, :blog_id, any_param)
361
+ end
362
+
348
363
  it "should work with any_param negative match different field without query" do
349
364
  Sunspot.search(Post) do
350
365
  without :category_ids, 4
@@ -89,6 +89,13 @@ class SunspotMatchersTest < Test::Unit::TestCase
89
89
  assert_has_no_search_params Sunspot.session, :keywords, any_param
90
90
  end
91
91
 
92
+ def test_match_fulltext
93
+ Sunspot.search(Post) do
94
+ fulltext 'great pizza'
95
+ end
96
+ assert_has_search_params Sunspot.session, :fulltext, 'great pizza'
97
+ end
98
+
92
99
  def test_with_matcher_matches
93
100
  Sunspot.search(Post) do
94
101
  with :author_name, 'Mark Twain'
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunspot_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.0
5
- prerelease:
4
+ version: 2.1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Joseph Palermo
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-20 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.0.0
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: 2.4.0
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: 2.4.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: sunspot
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: 2.1.0
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: 2.1.0
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: These matchers and assertions allow you to test what is happening inside
@@ -82,7 +73,7 @@ executables: []
82
73
  extensions: []
83
74
  extra_rdoc_files: []
84
75
  files:
85
- - .gitignore
76
+ - ".gitignore"
86
77
  - Gemfile
87
78
  - Gemfile.lock
88
79
  - MIT-LICENSE
@@ -100,26 +91,25 @@ files:
100
91
  homepage: https://github.com/pivotal/sunspot_matchers
101
92
  licenses:
102
93
  - MIT
94
+ metadata: {}
103
95
  post_install_message:
104
96
  rdoc_options: []
105
97
  require_paths:
106
98
  - lib
107
99
  required_ruby_version: !ruby/object:Gem::Requirement
108
- none: false
109
100
  requirements:
110
- - - ! '>='
101
+ - - ">="
111
102
  - !ruby/object:Gem::Version
112
103
  version: '0'
113
104
  required_rubygems_version: !ruby/object:Gem::Requirement
114
- none: false
115
105
  requirements:
116
- - - ! '>='
106
+ - - ">="
117
107
  - !ruby/object:Gem::Version
118
108
  version: 1.3.6
119
109
  requirements: []
120
110
  rubyforge_project:
121
- rubygems_version: 1.8.23
111
+ rubygems_version: 2.2.2
122
112
  signing_key:
123
- specification_version: 3
113
+ specification_version: 4
124
114
  summary: RSpec matchers and Test::Unit assertions for testing Sunspot
125
115
  test_files: []