picky 4.0.0pre2 → 4.0.0pre3

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.
Files changed (43) hide show
  1. data/aux/picky/cli.rb +1 -1
  2. data/lib/picky/backends/backend.rb +0 -16
  3. data/lib/picky/backends/file.rb +5 -10
  4. data/lib/picky/backends/memory.rb +5 -10
  5. data/lib/picky/backends/redis/basic.rb +3 -3
  6. data/lib/picky/backends/redis/list.rb +5 -6
  7. data/lib/picky/backends/redis/string.rb +1 -1
  8. data/lib/picky/backends/redis.rb +24 -27
  9. data/lib/picky/backends/sqlite/basic.rb +4 -4
  10. data/lib/picky/backends/sqlite.rb +7 -13
  11. data/lib/picky/bundle.rb +39 -43
  12. data/lib/picky/bundle_indexed.rb +17 -2
  13. data/lib/picky/bundle_indexing.rb +1 -26
  14. data/lib/picky/bundle_realtime.rb +2 -6
  15. data/lib/picky/category_indexing.rb +2 -2
  16. data/lib/picky/generators/similarity/phonetic.rb +3 -1
  17. data/lib/picky/index_indexing.rb +1 -1
  18. data/lib/picky/indexers/base.rb +5 -4
  19. data/lib/picky/indexers/parallel.rb +3 -3
  20. data/lib/picky/indexers/serial.rb +2 -2
  21. data/lib/picky/wrappers/bundle/location.rb +3 -5
  22. data/spec/functional/backends/redis_bundle_realtime_spec.rb +1 -1
  23. data/spec/functional/backends/redis_spec.rb +29 -6
  24. data/spec/functional/backends/special_spec.rb +229 -0
  25. data/spec/functional/backends/sqlite_bundle_realtime_spec.rb +1 -1
  26. data/spec/functional/backends/sqlite_spec.rb +1 -1
  27. data/spec/lib/backends/backend_spec.rb +40 -24
  28. data/spec/lib/backends/file_spec.rb +25 -25
  29. data/spec/lib/backends/memory_spec.rb +51 -51
  30. data/spec/lib/backends/redis_spec.rb +77 -77
  31. data/spec/lib/backends/sqlite/array_spec.rb +1 -1
  32. data/spec/lib/backends/sqlite_spec.rb +51 -51
  33. data/spec/lib/{indexed/bundle_spec.rb → bundle_indexed_spec.rb} +0 -0
  34. data/spec/lib/{indexing/bundle_spec.rb → bundle_indexing_spec.rb} +2 -9
  35. data/spec/lib/{indexing/bundle_partial_generation_speed_spec.rb → bundle_partial_generation_speed_spec.rb} +0 -0
  36. data/spec/lib/{indexed/bundle_realtime_spec.rb → bundle_realtime_spec.rb} +0 -0
  37. data/spec/lib/category_indexed_spec.rb +2 -2
  38. data/spec/lib/category_spec.rb +2 -2
  39. data/spec/lib/extensions/object_spec.rb +8 -8
  40. data/spec/lib/generators/similarity/phonetic_spec.rb +13 -7
  41. data/spec/lib/index_spec.rb +16 -0
  42. data/spec/lib/indexers/base_spec.rb +1 -1
  43. metadata +27 -25
@@ -20,21 +20,22 @@ module Picky
20
20
  # Starts the indexing process.
21
21
  #
22
22
  def prepare categories, scheduler = Scheduler.new
23
- check_source
23
+ source_for_prepare = source
24
+ check source_for_prepare
24
25
  categories.empty
25
- process categories, scheduler do |prepared_file|
26
+ process source_for_prepare, categories, scheduler do |prepared_file|
26
27
  notify_finished prepared_file
27
28
  end
28
29
  end
29
30
 
30
31
  # Explicitly reset the source to avoid caching trouble.
31
32
  #
32
- def reset_source
33
+ def reset source
33
34
  source.reset if source.respond_to?(:reset)
34
35
  source.reconnect! if source.respond_to?(:reconnect!)
35
36
  end
36
37
 
37
- def check_source # :nodoc:
38
+ def check source # :nodoc:
38
39
  raise "Trying to index without a source for #{@index_or_category.name}." unless source
39
40
  end
40
41
 
@@ -15,7 +15,7 @@ module Picky
15
15
  # Parameters:
16
16
  # * categories: An Enumerable of Category-s.
17
17
  #
18
- def process categories, scheduler = Scheduler.new
18
+ def process source_for_prepare, categories, scheduler = Scheduler.new
19
19
  # Prepare a combined object - array.
20
20
  #
21
21
  combined = categories.map do |category|
@@ -26,9 +26,9 @@ module Picky
26
26
  #
27
27
  objects = []
28
28
 
29
- reset_source
29
+ reset source_for_prepare
30
30
 
31
- source.each do |object|
31
+ source_for_prepare.each do |object|
32
32
 
33
33
  # Accumulate objects.
34
34
  #
@@ -16,7 +16,7 @@ module Picky
16
16
  # Parameters:
17
17
  # * categories: An enumerable of Category-s.
18
18
  #
19
- def process categories, scheduler = Scheduler.new
19
+ def process source_for_prepare, categories, scheduler = Scheduler.new
20
20
  categories.each do |category|
21
21
 
22
22
  category.prepared_index_file do |file|
@@ -25,7 +25,7 @@ module Picky
25
25
  result = []
26
26
  tokenizer = category.tokenizer
27
27
 
28
- reset_source
28
+ reset source_for_prepare
29
29
 
30
30
  source.harvest(category) do |*data|
31
31
 
@@ -40,7 +40,7 @@ module Picky
40
40
  # Save the config, then dump normally.
41
41
  #
42
42
  def dump
43
- bundle[:location_anchor] = @calculation.anchor
43
+ bundle['location_anchor'] = @calculation.anchor
44
44
 
45
45
  bundle.dump
46
46
  end
@@ -50,10 +50,8 @@ module Picky
50
50
  def load
51
51
  bundle.load
52
52
 
53
- # TODO Symbols (of the location_anchor!!!).
54
- # It should always be a Symbol.
55
- #
56
- @calculation.anchor = bundle['location_anchor'] && bundle['location_anchor'].to_f || raise("Configuration 'location_anchor' for #{bundle.identifier} missing. Did you run rake index already?")
53
+ location_anchor = bundle['location_anchor']
54
+ @calculation.anchor = location_anchor && location_anchor.to_f || raise("Configuration 'location_anchor' for #{bundle.identifier} missing. Did you run rake index already?")
57
55
  end
58
56
 
59
57
  end
@@ -14,7 +14,7 @@ describe Picky::Bundle do
14
14
  @weights,
15
15
  @partial,
16
16
  @similarity,
17
- backend: Picky::Backends::Redis.new(immediate: true)
17
+ backend: Picky::Backends::Redis.new(realtime: true)
18
18
  end
19
19
 
20
20
  it 'is by default an SQLite Array' do
@@ -129,12 +129,14 @@ describe Picky::Backends::Redis do
129
129
 
130
130
  books.search('title').ids.should == []
131
131
  end
132
- it 'handles dumping and loading' do
133
- data.dump
134
- data.load
135
-
136
- books.search('title').ids.should == [1]
137
- end
132
+ # TODO
133
+ #
134
+ # it 'handles dumping and loading' do
135
+ # data.dump
136
+ # data.load
137
+ #
138
+ # books.search('title').ids.should == [1]
139
+ # end
138
140
  end
139
141
 
140
142
  context 'to_s key format' do
@@ -164,4 +166,25 @@ describe Picky::Backends::Redis do
164
166
  end
165
167
  end
166
168
 
169
+ describe 'special case' do
170
+ before(:each) do
171
+ data.key_format :to_i
172
+ data.backend described_class.new
173
+ data.clear
174
+ end
175
+ it 'handles direct manipulation and []= correctly' do
176
+ data.each_category do |category|
177
+ category.exact.dump
178
+ category.exact.load
179
+ category.exact.inverted['test'] = [1, 2, 3]
180
+ category.exact.inverted['test'] = [4, 5, 6]
181
+ category.exact.inverted['test'].should == ["4", "5", "6"]
182
+ category.exact.inverted['test'].delete "5"
183
+ category.exact.inverted['test'].should == ["4", "6"]
184
+ category.exact.inverted['test'].unshift "3"
185
+ category.exact.inverted['test'].should == ["3", "4", "6"]
186
+ end
187
+ end
188
+ end
189
+
167
190
  end
@@ -0,0 +1,229 @@
1
+ # encoding: utf-8
2
+ #
3
+ require 'spec_helper'
4
+
5
+ # To test the interface definition.
6
+ #
7
+ class BackendInterfaceTester < Picky::Backends::Backend
8
+ def create_inverted _
9
+ InternalBackendInterfaceTester.new
10
+ end
11
+ def create_weights _
12
+ InternalBackendInterfaceTester.new
13
+ end
14
+ def create_similarity _
15
+ InternalBackendInterfaceTester.new
16
+ end
17
+ def create_configuration _
18
+ InternalBackendInterfaceTester.new
19
+ end
20
+ def create_realtime _
21
+ InternalBackendInterfaceTester.new
22
+ end
23
+ end
24
+ class InternalBackendInterfaceTester
25
+
26
+ def initialize
27
+ @hash = {}
28
+ end
29
+
30
+ def initial
31
+ self
32
+ end
33
+
34
+ def empty
35
+ self
36
+ end
37
+
38
+ def [] key
39
+ @hash[key]
40
+ end
41
+
42
+ def []= key, value
43
+ @hash[key] = value
44
+ end
45
+
46
+ def clear
47
+ @hash.clear
48
+ end
49
+
50
+ def delete key
51
+ @hash.delete key
52
+ end
53
+
54
+ # dump/load
55
+ #
56
+
57
+ def dump _
58
+
59
+ end
60
+
61
+ def load
62
+ self
63
+ end
64
+
65
+ end
66
+
67
+ # Describes a Picky index that uses the Memory backend
68
+ # for data storage.
69
+ #
70
+ describe BackendInterfaceTester do
71
+
72
+ class Book
73
+ attr_reader :id, :title, :author
74
+ def initialize id, title, author
75
+ @id, @title, @author = id, title, author
76
+ end
77
+ end
78
+
79
+ attr_reader :data, :books
80
+
81
+ let(:data) do
82
+ Picky::Index.new(:books) do
83
+ source []
84
+ category :title, partial: Picky::Partial::Postfix.new(from: 1)
85
+ category :author, similarity: Picky::Generators::Similarity::DoubleMetaphone.new(3)
86
+ end
87
+ end
88
+ let(:books) { Picky::Search.new data }
89
+
90
+ its_to_s = ->(*) do
91
+ it 'searching for it' do
92
+ books.search('title').ids.should == ['1']
93
+ end
94
+ it 'searching for it using multiple words' do
95
+ books.search('title author').ids.should == ['1']
96
+ end
97
+ it 'searching for it using partial' do
98
+ books.search('tit').ids.should == ['1']
99
+ end
100
+ it 'searching for it using similarity' do
101
+ books.search('aothor~').ids.should == ['1']
102
+ end
103
+ it 'handles removing' do
104
+ data.remove 1
105
+
106
+ books.search('title').ids.should == []
107
+ end
108
+ it 'handles removing with more than one entry' do
109
+ data.add Book.new(2, 'title', 'author')
110
+
111
+ books.search('title').ids.should == ['2', '1']
112
+
113
+ data.remove '1'
114
+
115
+ books.search('title').ids.should == ['2']
116
+ end
117
+ it 'handles removing with three entries' do
118
+ data.add Book.new(2, 'title', 'author')
119
+ data.add Book.new(3, 'title', 'author')
120
+
121
+ books.search('title').ids.should == ['3', '2', '1']
122
+
123
+ data.remove '1'
124
+
125
+ books.search('title').ids.should == ['3', '2']
126
+ end
127
+ it 'handles replacing' do
128
+ data.replace Book.new(1, 'toitle', 'oithor')
129
+
130
+ books.search('title').ids.should == []
131
+ books.search('toitle').ids.should == ['1']
132
+ end
133
+ it 'handles clearing' do
134
+ data.clear
135
+
136
+ books.search('title').ids.should == []
137
+ end
138
+ it 'handles dumping and loading' do
139
+ data.dump
140
+ data.load
141
+
142
+ books.search('title').ids.should == ['1']
143
+ end
144
+ end
145
+
146
+ its_to_i = ->(*) do
147
+ it 'searching for it' do
148
+ books.search('title').ids.should == [1]
149
+ end
150
+ it 'searching for it using multiple words' do
151
+ books.search('title author').ids.should == [1]
152
+ end
153
+ it 'searching for it using partial' do
154
+ books.search('tit').ids.should == [1]
155
+ end
156
+ it 'searching for it using similarity' do
157
+ books.search('aothor~').ids.should == [1]
158
+ end
159
+ it 'handles removing' do
160
+ data.remove 1
161
+
162
+ books.search('title').ids.should == []
163
+ end
164
+ it 'handles removing with more than one entry' do
165
+ data.add Book.new(2, 'title', 'author')
166
+
167
+ books.search('title').ids.should == [2, 1]
168
+
169
+ data.remove 1
170
+
171
+ books.search('title').ids.should == [2]
172
+ end
173
+ it 'handles removing with three entries' do
174
+ data.add Book.new(2, 'title', 'author')
175
+ data.add Book.new(3, 'title', 'author')
176
+
177
+ books.search('title').ids.should == [3, 2, 1]
178
+
179
+ data.remove 1
180
+
181
+ books.search('title').ids.should == [3, 2]
182
+ end
183
+ it 'handles replacing' do
184
+ data.replace Book.new(1, 'toitle', 'oithor')
185
+
186
+ books.search('title').ids.should == []
187
+ books.search('toitle').ids.should == [1]
188
+ end
189
+ it 'handles clearing' do
190
+ data.clear
191
+
192
+ books.search('title').ids.should == []
193
+ end
194
+ it 'handles dumping and loading' do
195
+ data.dump
196
+ data.load
197
+
198
+ books.search('title').ids.should == [1]
199
+ end
200
+ end
201
+
202
+ context 'to_s key format' do
203
+ context 'immediately indexing backend (no dump needed)' do
204
+ before(:each) do
205
+ data.key_format :to_s
206
+ data.backend described_class.new
207
+ data.clear
208
+
209
+ data.add Book.new(1, 'title', 'author')
210
+ end
211
+
212
+ instance_eval &its_to_s
213
+ end
214
+ end
215
+ context 'to_i key format' do
216
+ context 'immediately indexing backend (no dump needed)' do
217
+ before(:each) do
218
+ data.key_format :to_i
219
+ data.backend described_class.new
220
+ data.clear
221
+
222
+ data.add Book.new(1, 'title', 'author')
223
+ end
224
+
225
+ instance_eval &its_to_i
226
+ end
227
+ end
228
+
229
+ end
@@ -14,7 +14,7 @@ describe Picky::Bundle do
14
14
  @weights,
15
15
  @partial,
16
16
  @similarity,
17
- backend: Picky::Backends::SQLite.new(self_indexed: true)
17
+ backend: Picky::Backends::SQLite.new(realtime: true)
18
18
  end
19
19
 
20
20
  it 'is by default an SQLite Array' do
@@ -92,7 +92,7 @@ describe Picky::Backends::SQLite do
92
92
 
93
93
  context 'immediately indexing backend (no dump needed)' do
94
94
  before(:each) do
95
- data.backend described_class.new(self_indexed: true)
95
+ data.backend described_class.new(realtime: true)
96
96
  data.clear
97
97
 
98
98
  data.add Book.new(1, 'title', 'author')
@@ -4,34 +4,50 @@ describe Picky::Backends::Backend do
4
4
 
5
5
  let(:backend) { described_class.new }
6
6
 
7
- describe 'extract_lambda_or' do
8
- it 'returns a given non-lambda' do
9
- backend.extract_lambda_or(:thing).should == :thing
10
- end
11
- it 'calls a given lambda with the given args' do
12
- lam = ->() do
13
- :lam
14
- end
7
+ describe 'weight' do
8
+ it 'delegates to the parameter' do
9
+ combinations = stub :combinations
15
10
 
16
- backend.extract_lambda_or(lam).should == :lam
17
- end
18
- it 'calls a given lambda with the given args' do
19
- lam = ->(arg1) do
20
- arg1.should == 1
21
- :lam
22
- end
11
+ combinations.should_receive(:score).once.with()
23
12
 
24
- backend.extract_lambda_or(lam, 1).should == :lam
13
+ backend.weight combinations
25
14
  end
26
- it 'calls a given lambda with the given args' do
27
- lam = ->(arg1, arg2) do
28
- arg1.should == 1
29
- arg2.should == 2
30
- :lam
31
- end
32
-
33
- backend.extract_lambda_or(lam, 1, 2).should == :lam
15
+ end
16
+
17
+ describe 'to_s' do
18
+ it 'is correct' do
19
+ backend.to_s.should == 'Picky::Backends::Backend'
34
20
  end
35
21
  end
36
22
 
23
+ # describe 'extract_lambda_or' do
24
+ # it 'returns a given non-lambda' do
25
+ # backend.extract_lambda_or(:thing).should == :thing
26
+ # end
27
+ # it 'calls a given lambda with the given args' do
28
+ # lam = ->() do
29
+ # :lam
30
+ # end
31
+ #
32
+ # backend.extract_lambda_or(lam).should == :lam
33
+ # end
34
+ # it 'calls a given lambda with the given args' do
35
+ # lam = ->(arg1) do
36
+ # arg1.should == 1
37
+ # :lam
38
+ # end
39
+ #
40
+ # backend.extract_lambda_or(lam, 1).should == :lam
41
+ # end
42
+ # it 'calls a given lambda with the given args' do
43
+ # lam = ->(arg1, arg2) do
44
+ # arg1.should == 1
45
+ # arg2.should == 2
46
+ # :lam
47
+ # end
48
+ #
49
+ # backend.extract_lambda_or(lam, 1, 2).should == :lam
50
+ # end
51
+ # end
52
+
37
53
  end
@@ -2,31 +2,31 @@ require 'spec_helper'
2
2
 
3
3
  describe Picky::Backends::File do
4
4
 
5
- context 'with options' do
6
- before(:each) do
7
- @backend = described_class.new inverted: Picky::Backends::File::Basic.new(:unimportant),
8
- weights: Picky::Backends::File::Basic.new(:unimportant),
9
- similarity: Picky::Backends::File::Basic.new(:unimportant),
10
- configuration: Picky::Backends::File::Basic.new(:unimportant)
11
-
12
- @backend.stub! :timed_exclaim
13
- end
14
-
15
- describe 'create_...' do
16
- [
17
- [:inverted, Picky::Backends::File::Basic],
18
- [:weights, Picky::Backends::File::Basic],
19
- [:similarity, Picky::Backends::File::Basic],
20
- [:configuration, Picky::Backends::File::Basic]
21
- ].each do |type, kind|
22
- it "creates and returns a(n) #{type} index" do
23
- @backend.send(:"create_#{type}",
24
- stub(type, :index_path => "spec/test_directory/index/test/some_index/some_category_some_bundle_#{type}")
25
- ).should be_kind_of(kind)
26
- end
27
- end
28
- end
29
- end
5
+ # context 'with options' do
6
+ # before(:each) do
7
+ # @backend = described_class.new inverted: Picky::Backends::File::Basic.new(:unimportant),
8
+ # weights: Picky::Backends::File::Basic.new(:unimportant),
9
+ # similarity: Picky::Backends::File::Basic.new(:unimportant),
10
+ # configuration: Picky::Backends::File::Basic.new(:unimportant)
11
+ #
12
+ # @backend.stub! :timed_exclaim
13
+ # end
14
+ #
15
+ # describe 'create_...' do
16
+ # [
17
+ # [:inverted, Picky::Backends::File::Basic],
18
+ # [:weights, Picky::Backends::File::Basic],
19
+ # [:similarity, Picky::Backends::File::Basic],
20
+ # [:configuration, Picky::Backends::File::Basic]
21
+ # ].each do |type, kind|
22
+ # it "creates and returns a(n) #{type} index" do
23
+ # @backend.send(:"create_#{type}",
24
+ # stub(type, :index_path => "spec/test_directory/index/test/some_index/some_category_some_bundle_#{type}")
25
+ # ).should be_kind_of(kind)
26
+ # end
27
+ # end
28
+ # end
29
+ # end
30
30
 
31
31
  context 'without options' do
32
32
  before(:each) do
@@ -2,57 +2,57 @@ require 'spec_helper'
2
2
 
3
3
  describe Picky::Backends::Memory do
4
4
 
5
- context 'with options' do
6
- before(:each) do
7
- @backend = described_class.new inverted: Picky::Backends::Memory::Marshal.new(:unimportant),
8
- weights: Picky::Backends::Memory::Marshal.new(:unimportant),
9
- similarity: Picky::Backends::Memory::JSON.new(:unimportant),
10
- configuration: Picky::Backends::Memory::Marshal.new(:unimportant)
11
-
12
- @backend.stub! :timed_exclaim
13
- end
14
-
15
- describe 'create_...' do
16
- [
17
- [:inverted, Picky::Backends::Memory::Marshal],
18
- [:weights, Picky::Backends::Memory::Marshal],
19
- [:similarity, Picky::Backends::Memory::JSON],
20
- [:configuration, Picky::Backends::Memory::Marshal]
21
- ].each do |type, kind|
22
- it "creates and returns a(n) #{type} index" do
23
- @backend.send(:"create_#{type}",
24
- stub(type, :index_path => "spec/test_directory/index/test/some_index/some_category_some_bundle_#{type}")
25
- ).should be_kind_of(kind)
26
- end
27
- end
28
- end
29
- end
30
-
31
- context 'with lambda options' do
32
- before(:each) do
33
- @backend = described_class.new inverted: ->(bundle){ Picky::Backends::Memory::Marshal.new(bundle.index_path(:inverted)) },
34
- weights: ->(bundle){ Picky::Backends::Memory::Marshal.new(bundle.index_path(:weights)) },
35
- similarity: ->(bundle){ Picky::Backends::Memory::JSON.new(bundle.index_path(:similarity)) },
36
- configuration: ->(bundle){ Picky::Backends::Memory::Marshal.new(bundle.index_path(:configuration)) }
37
-
38
- @backend.stub! :timed_exclaim
39
- end
40
-
41
- describe 'create_...' do
42
- [
43
- [:inverted, Picky::Backends::Memory::Marshal],
44
- [:weights, Picky::Backends::Memory::Marshal],
45
- [:similarity, Picky::Backends::Memory::JSON],
46
- [:configuration, Picky::Backends::Memory::Marshal]
47
- ].each do |type, kind|
48
- it "creates and returns a(n) #{type} index" do
49
- to_a_able_stub = Object.new
50
- to_a_able_stub.stub! :index_path => "spec/test_directory/index/test/some_index/some_category_some_bundle_#{type}"
51
- @backend.send(:"create_#{type}", to_a_able_stub).should be_kind_of(kind)
52
- end
53
- end
54
- end
55
- end
5
+ # context 'with options' do
6
+ # before(:each) do
7
+ # @backend = described_class.new inverted: Picky::Backends::Memory::Marshal.new(:unimportant),
8
+ # weights: Picky::Backends::Memory::Marshal.new(:unimportant),
9
+ # similarity: Picky::Backends::Memory::JSON.new(:unimportant),
10
+ # configuration: Picky::Backends::Memory::Marshal.new(:unimportant)
11
+ #
12
+ # @backend.stub! :timed_exclaim
13
+ # end
14
+ #
15
+ # describe 'create_...' do
16
+ # [
17
+ # [:inverted, Picky::Backends::Memory::Marshal],
18
+ # [:weights, Picky::Backends::Memory::Marshal],
19
+ # [:similarity, Picky::Backends::Memory::JSON],
20
+ # [:configuration, Picky::Backends::Memory::Marshal]
21
+ # ].each do |type, kind|
22
+ # it "creates and returns a(n) #{type} index" do
23
+ # @backend.send(:"create_#{type}",
24
+ # stub(type, :index_path => "spec/test_directory/index/test/some_index/some_category_some_bundle_#{type}")
25
+ # ).should be_kind_of(kind)
26
+ # end
27
+ # end
28
+ # end
29
+ # end
30
+ #
31
+ # context 'with lambda options' do
32
+ # before(:each) do
33
+ # @backend = described_class.new inverted: ->(bundle){ Picky::Backends::Memory::Marshal.new(bundle.index_path(:inverted)) },
34
+ # weights: ->(bundle){ Picky::Backends::Memory::Marshal.new(bundle.index_path(:weights)) },
35
+ # similarity: ->(bundle){ Picky::Backends::Memory::JSON.new(bundle.index_path(:similarity)) },
36
+ # configuration: ->(bundle){ Picky::Backends::Memory::Marshal.new(bundle.index_path(:configuration)) }
37
+ #
38
+ # @backend.stub! :timed_exclaim
39
+ # end
40
+ #
41
+ # describe 'create_...' do
42
+ # [
43
+ # [:inverted, Picky::Backends::Memory::Marshal],
44
+ # [:weights, Picky::Backends::Memory::Marshal],
45
+ # [:similarity, Picky::Backends::Memory::JSON],
46
+ # [:configuration, Picky::Backends::Memory::Marshal]
47
+ # ].each do |type, kind|
48
+ # it "creates and returns a(n) #{type} index" do
49
+ # to_a_able_stub = Object.new
50
+ # to_a_able_stub.stub! :index_path => "spec/test_directory/index/test/some_index/some_category_some_bundle_#{type}"
51
+ # @backend.send(:"create_#{type}", to_a_able_stub).should be_kind_of(kind)
52
+ # end
53
+ # end
54
+ # end
55
+ # end
56
56
 
57
57
  context 'without options' do
58
58
  before(:each) do