picky 4.19.4 → 4.19.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/lib/picky/categories.rb +1 -0
  3. data/lib/picky/category_realtime.rb +1 -1
  4. data/lib/picky/index.rb +7 -1
  5. data/lib/picky/query/indexes/check.rb +2 -0
  6. data/lib/picky/query/or.rb +0 -13
  7. data/lib/picky/results.rb +4 -2
  8. data/lib/picky/search.rb +6 -8
  9. data/lib/picky/search_facets.rb +1 -1
  10. data/lib/picky.rb +5 -2
  11. data/spec/functional/or_spec.rb +1 -0
  12. data/spec/functional/to_s_spec.rb +57 -0
  13. data/spec/lib/api/search/boost_spec.rb +1 -1
  14. data/spec/lib/backends/backend_spec.rb +2 -2
  15. data/spec/lib/backends/file_spec.rb +25 -25
  16. data/spec/lib/backends/memory/json_spec.rb +1 -1
  17. data/spec/lib/backends/memory/marshal_spec.rb +1 -1
  18. data/spec/lib/backends/memory_spec.rb +28 -28
  19. data/spec/lib/backends/prepared/text_spec.rb +3 -3
  20. data/spec/lib/backends/redis/basic_spec.rb +1 -1
  21. data/spec/lib/backends/redis/directly_manipulable_spec.rb +8 -8
  22. data/spec/lib/backends/redis/float_spec.rb +3 -3
  23. data/spec/lib/backends/redis/list_spec.rb +2 -2
  24. data/spec/lib/backends/redis/string_spec.rb +2 -2
  25. data/spec/lib/backends/redis_spec.rb +33 -33
  26. data/spec/lib/backends/sqlite/array_spec.rb +12 -12
  27. data/spec/lib/backends/sqlite/directly_manipulable_spec.rb +4 -4
  28. data/spec/lib/backends/sqlite/value_spec.rb +8 -8
  29. data/spec/lib/backends/sqlite_spec.rb +28 -28
  30. data/spec/lib/bundle_indexed_spec.rb +14 -14
  31. data/spec/lib/categories_indexed_spec.rb +12 -12
  32. data/spec/lib/category_indexed_spec.rb +27 -27
  33. data/spec/lib/category_indexing_spec.rb +18 -18
  34. data/spec/lib/extensions/module_spec.rb +2 -2
  35. data/spec/lib/extensions/object_spec.rb +1 -1
  36. data/spec/lib/generators/partial/default_spec.rb +1 -1
  37. data/spec/lib/generators/partial/postfix_spec.rb +2 -2
  38. data/spec/lib/generators/similarity/phonetic_spec.rb +1 -1
  39. data/spec/lib/index_indexed_spec.rb +3 -3
  40. data/spec/lib/index_indexing_spec.rb +5 -5
  41. data/spec/lib/index_spec.rb +3 -3
  42. data/spec/lib/indexed/wrappers/bundle/calculation_spec.rb +1 -1
  43. data/spec/lib/indexed/wrappers/bundle/wrapper_spec.rb +1 -1
  44. data/spec/lib/indexers/base_spec.rb +8 -8
  45. data/spec/lib/indexers/parallel_spec.rb +6 -6
  46. data/spec/lib/indexers/serial_spec.rb +4 -4
  47. data/spec/lib/indexes_class_spec.rb +1 -1
  48. data/spec/lib/indexes_indexed_spec.rb +4 -4
  49. data/spec/lib/indexes_indexing_spec.rb +5 -5
  50. data/spec/lib/indexes_spec.rb +2 -2
  51. data/spec/lib/interfaces/live_parameters/master_child_spec.rb +13 -13
  52. data/spec/lib/interfaces/live_parameters/unicorn_spec.rb +13 -13
  53. data/spec/lib/loader_spec.rb +9 -9
  54. data/spec/lib/loggers/verbose_spec.rb +10 -3
  55. data/spec/lib/query/allocation_spec.rb +22 -22
  56. data/spec/lib/query/allocations_spec.rb +32 -32
  57. data/spec/lib/query/boosts_spec.rb +2 -2
  58. data/spec/lib/query/combination_spec.rb +5 -5
  59. data/spec/lib/query/combinations_spec.rb +8 -8
  60. data/spec/lib/query/indexes_check_spec.rb +6 -6
  61. data/spec/lib/query/indexes_spec.rb +8 -8
  62. data/spec/lib/query/solr_spec.rb +5 -5
  63. data/spec/lib/query/token_spec.rb +6 -6
  64. data/spec/lib/query/tokens_spec.rb +10 -10
  65. data/spec/lib/rack/harakiri_spec.rb +5 -5
  66. data/spec/lib/results/exact_first_spec.rb +23 -23
  67. data/spec/lib/results_spec.rb +10 -10
  68. data/spec/lib/scheduler_spec.rb +5 -5
  69. data/spec/lib/search_spec.rb +15 -15
  70. data/spec/lib/solr/schema_generator_spec.rb +7 -7
  71. data/spec/lib/tokenizer_spec.rb +3 -3
  72. metadata +48 -104
@@ -11,7 +11,7 @@ describe Picky::Query::Indexes::Check do
11
11
  ]
12
12
  backends.each do |backend|
13
13
  it 'does not raise on the same type' do
14
- index = stub :index, backend: backend
14
+ index = double :index, backend: backend
15
15
  described_class.check_backends [index, index]
16
16
  end
17
17
  end
@@ -20,8 +20,8 @@ describe Picky::Query::Indexes::Check do
20
20
  #
21
21
  combinations = backends.combination 2
22
22
  combinations.each do |backend1, backend2|
23
- let(:index1) { stub :index1, backend: backend1 }
24
- let(:index2) { stub :index2, backend: backend2 }
23
+ let(:index1) { double :index1, backend: backend1 }
24
+ let(:index2) { double :index2, backend: backend2 }
25
25
  it 'raises on multiple types' do
26
26
  expect do
27
27
  described_class.check_backends [index1, index2]
@@ -35,9 +35,9 @@ describe Picky::Query::Indexes::Check do
35
35
  end
36
36
  combinations = backends.combination 3
37
37
  combinations.each do |backend1, backend2, backend3|
38
- let(:index1) { stub :index1, backend: backend1 }
39
- let(:index2) { stub :index2, backend: backend2 }
40
- let(:index3) { stub :index2, backend: backend3 }
38
+ let(:index1) { double :index1, backend: backend1 }
39
+ let(:index2) { double :index2, backend: backend2 }
40
+ let(:index3) { double :index2, backend: backend3 }
41
41
  it 'raises on multiple types' do
42
42
  expect do
43
43
  described_class.check_backends [index1, index2, index3]
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Picky::Query::Indexes do
4
4
 
5
5
  before(:each) do
6
- Picky::Query::Indexes::Check.stub! :check_backends
6
+ Picky::Query::Indexes::Check.stub :check_backends
7
7
  end
8
8
 
9
9
  3.times do |i|
@@ -13,7 +13,7 @@ describe Picky::Query::Indexes do
13
13
 
14
14
  let(:indexes) do
15
15
  indexes = described_class.allocate
16
- indexes.stub! :map_categories
16
+ indexes.stub :map_categories
17
17
  indexes.send :initialize, index1, index2, index3
18
18
  indexes
19
19
  end
@@ -87,20 +87,20 @@ describe Picky::Query::Indexes do
87
87
 
88
88
  describe 'prepared_allocations_for' do
89
89
  before(:each) do
90
- @allocations = stub :allocations
91
- indexes.stub! :allocations_for => @allocations
90
+ @allocations = double :allocations
91
+ indexes.stub :allocations_for => @allocations
92
92
  end
93
93
  it 'calls the right method in order' do
94
- # @allocations.should_receive(:uniq!).once.ordered.with()
94
+ # @allocations.should_receive(:uniq!).once.ordered.with no_args
95
95
  @allocations.should_receive(:calculate_score).once.ordered.with(:some_weights)
96
- @allocations.should_receive(:sort!).once.ordered.with()
96
+ @allocations.should_receive(:sort!).once.ordered.with no_args
97
97
 
98
98
  indexes.prepared_allocations_for :some_tokens, :some_weights
99
99
  end
100
100
  it 'calls the right method in order' do
101
- # @allocations.should_receive(:uniq!).once.ordered.with()
101
+ # @allocations.should_receive(:uniq!).once.ordered.with no_args
102
102
  @allocations.should_receive(:calculate_score).once.ordered.with({})
103
- @allocations.should_receive(:sort!).once.ordered.with()
103
+ @allocations.should_receive(:sort!).once.ordered.with no_args
104
104
 
105
105
  indexes.prepared_allocations_for :some_tokens
106
106
  end
@@ -10,7 +10,7 @@
10
10
  # describe 'execute' do
11
11
  # context 'error cases' do
12
12
  # before(:each) do
13
- # @tokens = stub :tokens
13
+ # @tokens = double :tokens
14
14
  # end
15
15
  # context 'tokens are malformed' do
16
16
  #
@@ -20,10 +20,10 @@
20
20
  # end
21
21
  # context 'server raises' do
22
22
  # before(:each) do
23
- # @server.stub! :select => lambda { raise Solr::RequestError }
23
+ # @server.stub :select => lambda { raise Solr::RequestError }
24
24
  # end
25
25
  # it 'should not fail' do
26
- # @tokens.stub! :to_solr_query => ''
26
+ # @tokens.stub :to_solr_query => ''
27
27
  #
28
28
  # lambda { @server.execute(@tokens) }.should_not raise_error
29
29
  # end
@@ -34,8 +34,8 @@
34
34
  #
35
35
  # context 'with connected Server' do
36
36
  # before(:each) do
37
- # @server = stub :server
38
- # RSolr.stub! :connect => @server
37
+ # @server = double :server
38
+ # RSolr.stub :connect => @server
39
39
  # end
40
40
  # end
41
41
  #
@@ -75,8 +75,8 @@ describe Picky::Query::Token do
75
75
  let(:token) { described_class.processed 'similar~', 'Similar~' }
76
76
  context 'with similar' do
77
77
  before(:each) do
78
- @bundle = stub :bundle, :similar => ['array', 'of', 'similar']
79
- @category = stub :category, :bundle_for => @bundle
78
+ @bundle = double :bundle, :similar => ['array', 'of', 'similar']
79
+ @category = double :category, :bundle_for => @bundle
80
80
  end
81
81
  it 'returns a list of tokens' do
82
82
  token.similar_tokens_for(@category).each do |token|
@@ -102,8 +102,8 @@ describe Picky::Query::Token do
102
102
  end
103
103
  context 'without similar' do
104
104
  before(:each) do
105
- @bundle = stub :bundle, :similar => []
106
- @category = stub :category, :bundle_for => @bundle
105
+ @bundle = double :bundle, :similar => []
106
+ @category = double :category, :bundle_for => @bundle
107
107
  end
108
108
  it 'returns an empty list' do
109
109
  token.similar_tokens_for(@category).should == []
@@ -375,12 +375,12 @@ describe Picky::Query::Token do
375
375
  it "should be blank if the token text itself is blank" do
376
376
  token = described_class.processed ''
377
377
 
378
- token.blank?.should be_true
378
+ token.blank?.should be_truthy
379
379
  end
380
380
  it "should be non-blank if the token text itself is non-blank" do
381
381
  token = described_class.processed 'not empty'
382
382
 
383
- token.blank?.should be_false
383
+ token.blank?.should be_falsy
384
384
  end
385
385
  end
386
386
 
@@ -19,9 +19,9 @@ describe Picky::Query::Tokens do
19
19
 
20
20
  describe 'possible_combinations_in' do
21
21
  before(:each) do
22
- @token1 = stub :token1
23
- @token2 = stub :token2
24
- @token3 = stub :token3
22
+ @token1 = double :token1
23
+ @token2 = double :token2
24
+ @token3 = double :token3
25
25
 
26
26
  @tokens = described_class.new [@token1, @token2, @token3], true
27
27
  end
@@ -164,9 +164,9 @@ describe Picky::Query::Tokens do
164
164
 
165
165
  describe 'possible_combinations_in' do
166
166
  before(:each) do
167
- @token1 = stub :token1
168
- @token2 = stub :token2
169
- @token3 = stub :token3
167
+ @token1 = double :token1
168
+ @token2 = double :token2
169
+ @token3 = double :token3
170
170
 
171
171
  @tokens = described_class.new [@token1, @token2, @token3]
172
172
  end
@@ -229,15 +229,15 @@ describe Picky::Query::Tokens do
229
229
  def self.it_should_forward name
230
230
  describe name do
231
231
  before(:each) do
232
- @internal_tokens = mock :internal_tokens
232
+ @internal_tokens = double :internal_tokens
233
233
  @tokens = described_class.new @internal_tokens
234
234
  end
235
235
  it "should forward #{name} to the internal tokens" do
236
- proc_stub = lambda {}
236
+ proc_double = lambda {}
237
237
 
238
- @internal_tokens.should_receive(name).once.with &proc_stub
238
+ @internal_tokens.should_receive(name).once.with no_args, &proc_double
239
239
 
240
- @tokens.send name, &proc_stub
240
+ @tokens.send name, &proc_double
241
241
  end
242
242
  end
243
243
  end
@@ -8,8 +8,8 @@ require 'picky/rack/harakiri'
8
8
 
9
9
  describe Rack::Harakiri do
10
10
  before(:each) do
11
- @app = stub :app
12
- Process.stub! :kill # not taking any chances
11
+ @app = double :app
12
+ Process.stub :kill # not taking any chances
13
13
  end
14
14
  context "defaults" do
15
15
  before(:each) do
@@ -44,11 +44,11 @@ describe Rack::Harakiri do
44
44
  end
45
45
  describe "call" do
46
46
  before(:each) do
47
- @app.stub! :call
48
- @app.stub! :harakiri
47
+ @app.stub :call
48
+ @app.stub :harakiri
49
49
  end
50
50
  it "calls harakiri" do
51
- @ronin.should_receive(:harakiri).once.with
51
+ @ronin.should_receive(:harakiri).once.with no_args
52
52
 
53
53
  @ronin.call :env
54
54
  end
@@ -3,9 +3,9 @@ require 'spec_helper'
3
3
  describe Picky::Results::ExactFirst do
4
4
 
5
5
  before(:each) do
6
- @exact = stub :exact
7
- @partial = stub :partial
8
- @category = stub :category, :exact => @exact, :partial => @partial
6
+ @exact = double :exact
7
+ @partial = double :partial
8
+ @category = double :category, :exact => @exact, :partial => @partial
9
9
  @category.extend described_class
10
10
  end
11
11
 
@@ -37,71 +37,71 @@ describe Picky::Results::ExactFirst do
37
37
 
38
38
  describe 'ids' do
39
39
  it "uses first the exact, then the partial ids" do
40
- @exact.stub! :ids => [1,4,5,6]
41
- @partial.stub! :ids => [2,3,7]
40
+ @exact.stub :ids => [1,4,5,6]
41
+ @partial.stub :ids => [2,3,7]
42
42
 
43
- @category.ids(stub(:token, :text => :anything, :partial? => true)).should == [1,4,5,6,2,3,7]
43
+ @category.ids(double(:token, :text => :anything, :partial? => true)).should == [1,4,5,6,2,3,7]
44
44
  end
45
45
  it "uses only the exact ids" do
46
- @exact.stub! :ids => [1,4,5,6]
47
- @partial.stub! :ids => [2,3,7]
46
+ @exact.stub :ids => [1,4,5,6]
47
+ @partial.stub :ids => [2,3,7]
48
48
 
49
- @category.ids(stub(:token, :text => :anything, :partial? => false)).should == [1,4,5,6]
49
+ @category.ids(double(:token, :text => :anything, :partial? => false)).should == [1,4,5,6]
50
50
  end
51
51
  end
52
52
 
53
53
  describe 'weight' do
54
54
  context "exact with weight" do
55
55
  before(:each) do
56
- @exact.stub! :weight => 0.12
56
+ @exact.stub :weight => 0.12
57
57
  end
58
58
  context "partial with weight" do
59
59
  before(:each) do
60
- @partial.stub! :weight => 1.23
60
+ @partial.stub :weight => 1.23
61
61
  end
62
62
  it "uses the higher weight" do
63
- @category.weight(stub(:token, :text => :anything, :partial? => true)).should == 1.23
63
+ @category.weight(double(:token, :text => :anything, :partial? => true)).should == 1.23
64
64
  end
65
65
  it "uses the exact weight" do
66
- @category.weight(stub(:token, :text => :anything, :partial? => false)).should == 0.12
66
+ @category.weight(double(:token, :text => :anything, :partial? => false)).should == 0.12
67
67
  end
68
68
  end
69
69
  context "partial without weight" do
70
70
  before(:each) do
71
- @partial.stub! :weight => nil
71
+ @partial.stub :weight => nil
72
72
  end
73
73
  it "uses the exact weight" do
74
- @category.weight(stub(:token, :text => :anything, :partial? => true)).should == 0.12
74
+ @category.weight(double(:token, :text => :anything, :partial? => true)).should == 0.12
75
75
  end
76
76
  it "uses the exact weight" do
77
- @category.weight(stub(:token, :text => :anything, :partial? => false)).should == 0.12
77
+ @category.weight(double(:token, :text => :anything, :partial? => false)).should == 0.12
78
78
  end
79
79
  end
80
80
  end
81
81
  context "exact without weight" do
82
82
  before(:each) do
83
- @exact.stub! :weight => nil
83
+ @exact.stub :weight => nil
84
84
  end
85
85
  context "partial with weight" do
86
86
  before(:each) do
87
- @partial.stub! :weight => 0.12
87
+ @partial.stub :weight => 0.12
88
88
  end
89
89
  it "uses the partial weight" do
90
- @category.weight(stub(:token, :text => :anything, :partial? => true)).should == 0.12
90
+ @category.weight(double(:token, :text => :anything, :partial? => true)).should == 0.12
91
91
  end
92
92
  it "uses the exact weight" do
93
- @category.weight(stub(:token, :text => :anything, :partial? => false)).should == nil
93
+ @category.weight(double(:token, :text => :anything, :partial? => false)).should == nil
94
94
  end
95
95
  end
96
96
  context "partial without weight" do
97
97
  before(:each) do
98
- @partial.stub! :weight => nil
98
+ @partial.stub :weight => nil
99
99
  end
100
100
  it "is nil" do
101
- @category.weight(stub(:token, :text => :anything, :partial? => true)).should == nil
101
+ @category.weight(double(:token, :text => :anything, :partial? => true)).should == nil
102
102
  end
103
103
  it "is nil" do
104
- @category.weight(stub(:token, :text => :anything, :partial? => false)).should == nil
104
+ @category.weight(double(:token, :text => :anything, :partial? => false)).should == nil
105
105
  end
106
106
  end
107
107
  end
@@ -4,10 +4,10 @@ describe Picky::Results do
4
4
 
5
5
  describe "from" do
6
6
  before(:each) do
7
- @results = stub :results
8
- described_class.stub! :new => @results
7
+ @results = double :results
8
+ described_class.stub :new => @results
9
9
 
10
- @results.stub! :prepare!
10
+ @results.stub :prepare!
11
11
  end
12
12
  it "should generate a result" do
13
13
  described_class.from("some query", 20, 0, @allocations).should == @results
@@ -16,7 +16,7 @@ describe Picky::Results do
16
16
 
17
17
  describe "ids" do
18
18
  before(:each) do
19
- @allocations = stub :allocations
19
+ @allocations = double :allocations
20
20
  @results = described_class.new :unimportant, :amount, :unimportant, @allocations
21
21
  end
22
22
  it "forwards" do
@@ -40,8 +40,8 @@ describe Picky::Results do
40
40
 
41
41
  describe 'to_s' do
42
42
  before(:each) do
43
- time = stub :time, :strftime => '2011-08-16 10:07:33'
44
- Time.stub! :now => time
43
+ time = double :time, :strftime => '2011-08-16 10:07:33'
44
+ Time.stub :now => time
45
45
  end
46
46
  context 'without results' do
47
47
  before(:each) do
@@ -53,12 +53,12 @@ describe Picky::Results do
53
53
  end
54
54
  context 'with results' do
55
55
  before(:each) do
56
- @allocations = stub :allocations,
56
+ @allocations = double :allocations,
57
57
  :process! => nil,
58
58
  :size => 12
59
59
 
60
60
  @results = described_class.new "some_query", 20, 1234, @allocations
61
- @results.stub! :duration => 0.1234567890,
61
+ @results.stub :duration => 0.1234567890,
62
62
  :total => 12345678
63
63
  end
64
64
  it 'should output a specific log' do
@@ -72,7 +72,7 @@ describe Picky::Results do
72
72
  @results = described_class.new
73
73
  end
74
74
  it 'should do it correctly' do
75
- @results.stub! :to_hash => :serialized
75
+ @results.stub :to_hash => :serialized
76
76
 
77
77
  @results.to_json.should == '"serialized"'
78
78
  end
@@ -80,7 +80,7 @@ describe Picky::Results do
80
80
 
81
81
  describe 'to_hash' do
82
82
  before(:each) do
83
- @allocations = stub :allocations, :process! => nil, :to_result => :allocations, :total => :some_total
83
+ @allocations = double :allocations, :process! => nil, :to_result => :allocations, :total => :some_total
84
84
 
85
85
  @results = described_class.new :unimportant, :some_results_amount, :some_offset, @allocations
86
86
  @results.duration = :some_duration
@@ -8,7 +8,7 @@ describe Picky::Scheduler do
8
8
 
9
9
  context 'without forking' do
10
10
  before(:each) do
11
- scheduler.stub! :fork? => false
11
+ scheduler.stub :fork? => false
12
12
  end
13
13
  context 'non-stubbed forking' do
14
14
  it 'works correctly' do
@@ -33,15 +33,15 @@ describe Picky::Scheduler do
33
33
  describe 'fork?' do
34
34
  context 'OS can fork' do
35
35
  it 'returns false' do
36
- scheduler.fork?.should be_false
36
+ scheduler.fork?.should be_falsy
37
37
  end
38
38
  end
39
39
  context 'OS cannot fork' do
40
40
  before(:each) do
41
- Process.stub! :fork => nil
41
+ Process.stub :fork => nil
42
42
  end
43
43
  it 'returns false' do
44
- scheduler.fork?.should be_false
44
+ scheduler.fork?.should be_falsy
45
45
  end
46
46
  end
47
47
  end
@@ -59,7 +59,7 @@ describe Picky::Scheduler do
59
59
  scheduler.schedule { sleep 0.01 }
60
60
  end
61
61
  it 'works correctly' do
62
- scheduler.scheduler.should_receive(:schedule).any_number_of_times.and_yield
62
+ scheduler.scheduler.should_receive(:schedule).at_least(1).and_yield
63
63
 
64
64
  called = 0
65
65
 
@@ -5,8 +5,8 @@ require 'spec_helper'
5
5
  describe Picky::Search do
6
6
 
7
7
  before(:each) do
8
- @type = stub :type
9
- @index = stub :some_index,
8
+ @type = double :type
9
+ @index = double :some_index,
10
10
  :internal_indexed => @type,
11
11
  :each_category => [],
12
12
  :backend => Picky::Backends::Memory.new
@@ -15,8 +15,8 @@ describe Picky::Search do
15
15
  describe 'tokenized' do
16
16
  let(:search) { described_class.new }
17
17
  it 'forwards to the tokenizer' do
18
- tokenizer = stub :tokenizer
19
- search.stub! :tokenizer => tokenizer
18
+ tokenizer = double :tokenizer
19
+ search.stub :tokenizer => tokenizer
20
20
 
21
21
  tokenizer.should_receive(:tokenize).once.with(:some_text).and_return [['some_text'], [:some_original]]
22
22
 
@@ -55,7 +55,7 @@ describe Picky::Search do
55
55
  end
56
56
  end
57
57
  context 'tokenizer predefined' do
58
- let(:predefined) { stub(:tokenizer, :tokenize => nil) }
58
+ let(:predefined) { double(:tokenizer, :tokenize => nil) }
59
59
  context 'by way of DSL' do
60
60
  let(:search) { pre = predefined; described_class.new { searching pre } }
61
61
  it 'returns the predefined tokenizer' do
@@ -89,28 +89,28 @@ describe Picky::Search do
89
89
  @search = described_class.new
90
90
  end
91
91
  it "forwards to search_with correctly" do
92
- @search.stub! :tokenized => :tokens
92
+ @search.stub :tokenized => :tokens
93
93
 
94
94
  @search.should_receive(:search_with).once.with :tokens, 20, 10, :text, nil
95
95
 
96
96
  @search.search :text, 20, 10
97
97
  end
98
98
  it "forwards to search_with correctly" do
99
- @search.stub! :tokenized => :tokens
99
+ @search.stub :tokenized => :tokens
100
100
 
101
101
  @search.should_receive(:search_with).once.with :tokens, 20, 0, :text, nil
102
102
 
103
103
  @search.search :text, 20, 0
104
104
  end
105
105
  it "forwards to search_with correctly" do
106
- @search.stub! :tokenized => :tokens
106
+ @search.stub :tokenized => :tokens
107
107
 
108
108
  @search.should_receive(:search_with).once.with :tokens, 20, 0, :text, true
109
109
 
110
110
  @search.search :text, 20, 0, unique: true
111
111
  end
112
112
  it "uses the tokenizer" do
113
- @search.stub! :search_with
113
+ @search.stub :search_with
114
114
 
115
115
  @search.should_receive(:tokenized).once.with :text
116
116
 
@@ -122,7 +122,7 @@ describe Picky::Search do
122
122
  let(:search) { described_class.new @index }
123
123
  context 'by default' do
124
124
  it 'is falsy' do
125
- search.ignore_unassigned.should be_false
125
+ search.ignore_unassigned.should be_falsy
126
126
  end
127
127
  end
128
128
  context 'set to nothing' do
@@ -130,7 +130,7 @@ describe Picky::Search do
130
130
  search.ignore_unassigned_tokens
131
131
  end
132
132
  it 'is truey' do
133
- search.ignore_unassigned.should be_true
133
+ search.ignore_unassigned.should be_truthy
134
134
  end
135
135
  end
136
136
  context 'set to true' do
@@ -138,7 +138,7 @@ describe Picky::Search do
138
138
  search.ignore_unassigned_tokens true
139
139
  end
140
140
  it 'is truey' do
141
- search.ignore_unassigned.should be_true
141
+ search.ignore_unassigned.should be_truthy
142
142
  end
143
143
  end
144
144
  context 'set to false' do
@@ -146,7 +146,7 @@ describe Picky::Search do
146
146
  search.ignore_unassigned_tokens false
147
147
  end
148
148
  it 'is falsy' do
149
- search.ignore_unassigned.should be_false
149
+ search.ignore_unassigned.should be_falsy
150
150
  end
151
151
  end
152
152
  end
@@ -154,7 +154,7 @@ describe Picky::Search do
154
154
  describe 'initializer' do
155
155
  context 'with tokenizer' do
156
156
  before(:each) do
157
- tokenizer = stub :tokenizer, :tokenize => [['some_text'], ['some_original']]
157
+ tokenizer = double :tokenizer, :tokenize => [['some_text'], ['some_original']]
158
158
  @search = described_class.new @index do
159
159
  searching tokenizer
160
160
  end
@@ -167,7 +167,7 @@ describe Picky::Search do
167
167
 
168
168
  describe 'to_s' do
169
169
  before(:each) do
170
- @index.stub! :name => :some_index, :each_category => []
170
+ @index.stub :name => :some_index, :each_category => []
171
171
  end
172
172
  context 'without indexes' do
173
173
  before(:each) do
@@ -4,14 +4,14 @@
4
4
  # describe Solr::SchemaGenerator do
5
5
  #
6
6
  # before(:each) do
7
- # @types = stub :types
8
- # @configuration = stub :configuration, :types => @types
7
+ # @types = double :types
8
+ # @configuration = double :configuration, :types => @types
9
9
  # @generator = Solr::SchemaGenerator.new @configuration
10
10
  # end
11
11
  #
12
12
  # describe 'bound_field_names' do
13
13
  # before(:each) do
14
- # @generator.stub! :combine_field_names => :some_field_names
14
+ # @generator.stub :combine_field_names => :some_field_names
15
15
  # end
16
16
  # it 'should bind field_names' do
17
17
  # b = @generator.bound_field_names
@@ -22,18 +22,18 @@
22
22
  #
23
23
  # describe 'generate' do
24
24
  # before(:each) do
25
- # @generator.stub! :bound_field_names
26
- # @generator.stub! :generate_schema_for
25
+ # @generator.stub :bound_field_names
26
+ # @generator.stub :generate_schema_for
27
27
  # end
28
28
  # it 'should receive generate_schema_for once with the result of extract_binding' do
29
- # @generator.stub! :bound_field_names => :some_binding
29
+ # @generator.stub :bound_field_names => :some_binding
30
30
  #
31
31
  # @generator.should_receive(:generate_schema_for).once.with :some_binding
32
32
  #
33
33
  # @generator.generate
34
34
  # end
35
35
  # it 'should extract the binding' do
36
- # @generator.should_receive(:bound_field_names).once.with
36
+ # @generator.should_receive(:bound_field_names).once.with no_args
37
37
  #
38
38
  # @generator.generate
39
39
  # end
@@ -110,7 +110,7 @@ ERROR
110
110
  expect { tokenizer.normalize_with_patterns('any') }.to_not raise_error
111
111
  end
112
112
  it 'should define a method normalize_with_patterns does nothing' do
113
- unchanging = stub :unchanging
113
+ unchanging = double :unchanging
114
114
 
115
115
  tokenizer.normalize_with_patterns(unchanging).should == unchanging
116
116
  end
@@ -167,7 +167,7 @@ ERROR
167
167
 
168
168
  describe "splits_text_on" do
169
169
  it 'handles nonbroken arguments' do
170
- expect { tokenizer.splits_text_on("hello") }.to_not raise_error(ArgumentError)
170
+ expect { tokenizer.splits_text_on("hello") }.to_not raise_error
171
171
  end
172
172
  it 'handles broken arguments' do
173
173
  expect { tokenizer.splits_text_on(:gnorf) }.to raise_error(ArgumentError)
@@ -220,7 +220,7 @@ ERROR
220
220
  expect { tokenizer.remove_illegals('any') }.to_not raise_error
221
221
  end
222
222
  it 'should define a method remove_illegals that does nothing' do
223
- unchanging = stub :unchanging
223
+ unchanging = double :unchanging
224
224
 
225
225
  tokenizer.remove_illegals unchanging
226
226
  end