picky 3.2.0 → 3.3.0

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 (85) hide show
  1. data/aux/picky/cli.rb +3 -1
  2. data/lib/picky/backends/backend.rb +16 -0
  3. data/lib/picky/backends/file/basic.rb +18 -9
  4. data/lib/picky/backends/file/json.rb +1 -0
  5. data/lib/picky/backends/file.rb +8 -4
  6. data/lib/picky/backends/helpers/file.rb +6 -0
  7. data/lib/picky/backends/memory/basic.rb +10 -2
  8. data/lib/picky/backends/memory/json.rb +1 -6
  9. data/lib/picky/backends/memory/marshal.rb +1 -6
  10. data/lib/picky/backends/memory/text.rb +1 -0
  11. data/lib/picky/backends/memory.rb +8 -4
  12. data/lib/picky/backends/redis/basic.rb +12 -9
  13. data/lib/picky/backends/redis.rb +10 -4
  14. data/lib/picky/bundle.rb +14 -0
  15. data/lib/picky/bundle_indexed.rb +110 -0
  16. data/lib/picky/bundle_indexing.rb +177 -0
  17. data/lib/picky/bundle_realtime.rb +80 -0
  18. data/lib/picky/categories.rb +5 -1
  19. data/lib/picky/category.rb +12 -20
  20. data/lib/picky/category_indexed.rb +3 -6
  21. data/lib/picky/category_indexing.rb +19 -18
  22. data/lib/picky/category_realtime.rb +5 -10
  23. data/lib/picky/extensions/symbol.rb +1 -1
  24. data/lib/picky/generators/partial/default.rb +1 -1
  25. data/lib/picky/generators/partial/postfix.rb +30 -0
  26. data/lib/picky/generators/partial/substring.rb +8 -2
  27. data/lib/picky/index.rb +3 -3
  28. data/lib/picky/index_indexing.rb +3 -2
  29. data/lib/picky/indexers/base.rb +0 -8
  30. data/lib/picky/indexers/parallel.rb +1 -1
  31. data/lib/picky/loader.rb +15 -15
  32. data/lib/picky/query/qualifier_category_mapper.rb +1 -1
  33. data/lib/picky/rack/harakiri.rb +3 -1
  34. data/lib/picky/sources/db.rb +11 -0
  35. data/lib/picky/statistics.rb +2 -2
  36. data/lib/picky/tokenizer.rb +1 -1
  37. data/lib/picky/tokenizers/location.rb +1 -1
  38. data/lib/picky/wrappers/bundle/calculation.rb +45 -0
  39. data/lib/picky/wrappers/bundle/delegators.rb +69 -0
  40. data/lib/picky/wrappers/bundle/exact_partial.rb +38 -0
  41. data/lib/picky/{indexed/wrappers → wrappers}/bundle/location.rb +6 -4
  42. data/lib/picky/wrappers/bundle/wrapper.rb +29 -0
  43. data/lib/picky/wrappers/category/exact_first.rb +55 -0
  44. data/lib/picky/wrappers/category/location.rb +33 -0
  45. data/lib/picky/{sources/wrappers → wrappers/sources}/base.rb +7 -3
  46. data/lib/picky/{sources/wrappers → wrappers/sources}/location.rb +3 -3
  47. data/lib/picky.rb +10 -11
  48. data/spec/aux/picky/cli_spec.rb +5 -5
  49. data/spec/lib/backends/backend_spec.rb +39 -0
  50. data/spec/lib/backends/file/basic_spec.rb +59 -0
  51. data/spec/lib/backends/file_spec.rb +105 -0
  52. data/spec/lib/backends/memory/basic_spec.rb +43 -15
  53. data/spec/lib/backends/memory_spec.rb +108 -54
  54. data/spec/lib/backends/redis/basic_spec.rb +81 -57
  55. data/spec/lib/backends/redis_spec.rb +120 -66
  56. data/spec/lib/category_indexed_spec.rb +12 -12
  57. data/spec/lib/category_indexing_spec.rb +23 -23
  58. data/spec/lib/category_spec.rb +14 -14
  59. data/spec/lib/cores_spec.rb +2 -2
  60. data/spec/lib/extensions/object_spec.rb +7 -7
  61. data/spec/lib/generators/partial/postfix_spec.rb +131 -0
  62. data/spec/lib/generators/partial/substring_spec.rb +29 -4
  63. data/spec/lib/generators/weights_generator_spec.rb +3 -3
  64. data/spec/lib/index_indexing_spec.rb +11 -15
  65. data/spec/lib/index_spec.rb +8 -8
  66. data/spec/lib/indexed/bundle_realtime_spec.rb +18 -18
  67. data/spec/lib/indexed/bundle_spec.rb +21 -21
  68. data/spec/lib/indexed/wrappers/bundle/calculation_spec.rb +9 -9
  69. data/spec/lib/indexed/wrappers/bundle/wrapper_spec.rb +8 -8
  70. data/spec/lib/indexed/wrappers/exact_first_spec.rb +16 -16
  71. data/spec/lib/indexers/base_spec.rb +6 -25
  72. data/spec/lib/indexes_spec.rb +33 -22
  73. data/spec/lib/indexing/bundle_partial_generation_speed_spec.rb +2 -2
  74. data/spec/lib/indexing/bundle_spec.rb +27 -28
  75. data/spec/lib/sources/wrappers/base_spec.rb +7 -7
  76. data/spec/lib/sources/wrappers/location_spec.rb +8 -8
  77. metadata +48 -38
  78. data/lib/picky/indexed/bundle.rb +0 -125
  79. data/lib/picky/indexed/bundle_realtime.rb +0 -76
  80. data/lib/picky/indexed/wrappers/bundle/calculation.rb +0 -47
  81. data/lib/picky/indexed/wrappers/bundle/wrapper.rb +0 -47
  82. data/lib/picky/indexed/wrappers/category/location.rb +0 -31
  83. data/lib/picky/indexed/wrappers/exact_first.rb +0 -59
  84. data/lib/picky/indexing/bundle.rb +0 -183
  85. data/lib/picky/indexing/wrappers/category/location.rb +0 -29
@@ -1,23 +1,23 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Picky::Indexed::Bundle do
3
+ describe Picky::Bundle do
4
4
 
5
5
  before(:each) do
6
6
  @index = Picky::Index.new :some_index
7
7
  @category = Picky::Category.new :some_category, @index
8
-
8
+
9
9
  @weights = stub :weights
10
10
  @partial = stub :partial
11
11
  @similarity = stub :similarity
12
12
  @bundle = described_class.new :some_name, @category, Picky::Backends::Memory.new, @weights, @partial, @similarity
13
13
  end
14
-
14
+
15
15
  describe 'to_s' do
16
16
  it 'does something' do
17
- @bundle.to_s.should == "Picky::Indexed::Bundle(test:some_index:some_category:some_name)"
17
+ @bundle.to_s.should == "Picky::Bundle(test:some_index:some_category:some_name)"
18
18
  end
19
19
  end
20
-
20
+
21
21
  describe 'clear_index' do
22
22
  before(:each) do
23
23
  @bundle.instance_variable_set :@inverted, { :a => [] }
@@ -27,7 +27,7 @@ describe Picky::Indexed::Bundle do
27
27
  end
28
28
  it 'clears the inverted index' do
29
29
  @bundle.clear_inverted
30
-
30
+
31
31
  @bundle.inverted.should be_empty
32
32
  end
33
33
  end
@@ -40,7 +40,7 @@ describe Picky::Indexed::Bundle do
40
40
  end
41
41
  it 'clears the weights' do
42
42
  @bundle.clear_weights
43
-
43
+
44
44
  @bundle.weights.should be_empty
45
45
  end
46
46
  end
@@ -53,7 +53,7 @@ describe Picky::Indexed::Bundle do
53
53
  end
54
54
  it 'clears the similarity index' do
55
55
  @bundle.clear_similarity
56
-
56
+
57
57
  @bundle.similarity.should be_empty
58
58
  end
59
59
  end
@@ -66,7 +66,7 @@ describe Picky::Indexed::Bundle do
66
66
  end
67
67
  it 'clears the similarity index' do
68
68
  @bundle.clear_configuration
69
-
69
+
70
70
  @bundle.configuration.should be_empty
71
71
  end
72
72
  end
@@ -100,14 +100,14 @@ describe Picky::Indexed::Bundle do
100
100
  @bundle.weight(:existing).should == :specific
101
101
  end
102
102
  end
103
-
103
+
104
104
  describe 'load' do
105
105
  it 'should trigger loads' do
106
106
  @bundle.should_receive(:load_inverted).once.with
107
107
  @bundle.should_receive(:load_weights).once.with
108
108
  @bundle.should_receive(:load_similarity).once.with
109
109
  @bundle.should_receive(:load_configuration).once.with
110
-
110
+
111
111
  @bundle.load
112
112
  end
113
113
  end
@@ -118,46 +118,46 @@ describe Picky::Indexed::Bundle do
118
118
  describe "load_index" do
119
119
  it "uses the right file" do
120
120
  Yajl::Parser.stub! :parse
121
-
121
+
122
122
  File.should_receive(:open).once.with 'spec/test_directory/index/test/some_index/some_category_some_name_inverted.memory.json', 'r'
123
-
123
+
124
124
  @bundle.load_inverted
125
125
  end
126
126
  end
127
127
  describe "load_weights" do
128
128
  it "uses the right file" do
129
129
  Yajl::Parser.stub! :parse
130
-
130
+
131
131
  File.should_receive(:open).once.with 'spec/test_directory/index/test/some_index/some_category_some_name_weights.memory.json', 'r'
132
-
132
+
133
133
  @bundle.load_weights
134
134
  end
135
135
  end
136
136
  describe "load_similarity" do
137
137
  it "uses the right file" do
138
138
  Marshal.stub! :load
139
-
139
+
140
140
  File.should_receive(:open).once.with 'spec/test_directory/index/test/some_index/some_category_some_name_similarity.memory.dump', 'r:binary'
141
-
141
+
142
142
  @bundle.load_similarity
143
143
  end
144
144
  end
145
145
  describe "load_configuration" do
146
146
  it "uses the right file" do
147
147
  Yajl::Parser.stub! :parse
148
-
148
+
149
149
  File.should_receive(:open).once.with 'spec/test_directory/index/test/some_index/some_category_some_name_configuration.memory.json', 'r'
150
-
150
+
151
151
  @bundle.load_configuration
152
152
  end
153
153
  end
154
154
  end
155
-
155
+
156
156
  describe 'initialization' do
157
157
  before(:each) do
158
158
  @index = Picky::Index.new :some_index
159
159
  @category = Picky::Category.new :some_category, @index
160
-
160
+
161
161
  @bundle = described_class.new :some_name, @category, Picky::Backends::Memory.new, :weights, :partial, :similarity
162
162
  end
163
163
  it 'should initialize the index correctly' do
@@ -1,36 +1,36 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Picky::Indexed::Wrappers::Bundle::Calculation do
4
-
3
+ describe Picky::Wrappers::Bundle::Calculation do
4
+
5
5
  before(:each) do
6
6
  @bundle = stub :bundle
7
7
  @calculation = described_class.new @bundle
8
8
  end
9
-
9
+
10
10
  describe 'ids' do
11
11
  it 'calls bundle#ids correctly' do
12
12
  @bundle.should_receive(:ids).once.with :'0.0'
13
-
13
+
14
14
  @calculation.ids :some_sym
15
15
  end
16
16
  it 'calls bundle#ids correctly' do
17
17
  @bundle.should_receive(:ids).once.with :'6.28'
18
-
18
+
19
19
  @calculation.ids :'6.28'
20
20
  end
21
21
  end
22
-
22
+
23
23
  describe 'weight' do
24
24
  it 'calls bundle#ids correctly' do
25
25
  @bundle.should_receive(:weight).once.with :'0.0'
26
-
26
+
27
27
  @calculation.weight :some_sym
28
28
  end
29
29
  it 'calls bundle#ids correctly' do
30
30
  @bundle.should_receive(:weight).once.with :'6.28'
31
-
31
+
32
32
  @calculation.weight :'6.28'
33
33
  end
34
34
  end
35
-
35
+
36
36
  end
@@ -1,27 +1,27 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Picky::Indexed::Wrappers::Bundle::Wrapper do
4
-
3
+ describe Picky::Wrappers::Bundle::Wrapper do
4
+
5
5
  before(:each) do
6
6
  @bundle = stub :bundle
7
-
7
+
8
8
  @calculation = described_class.new @bundle
9
9
  end
10
-
10
+
11
11
  describe 'ids' do
12
12
  it 'calls bundle#ids correctly' do
13
13
  @bundle.should_receive(:ids).once.with :some_sym
14
-
14
+
15
15
  @calculation.ids :some_sym
16
16
  end
17
17
  end
18
-
18
+
19
19
  describe 'weight' do
20
20
  it 'calls bundle#ids correctly' do
21
21
  @bundle.should_receive(:weight).once.with :some_sym
22
-
22
+
23
23
  @calculation.weight :some_sym
24
24
  end
25
25
  end
26
-
26
+
27
27
  end
@@ -1,52 +1,52 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Picky::Indexed::Wrappers::ExactFirst do
4
-
3
+ describe Picky::Wrappers::ExactFirst do
4
+
5
5
  before(:each) do
6
6
  @exact = stub :exact
7
7
  @partial = stub :partial
8
- @category = stub :category, :indexed_exact => @exact, :indexed_partial => @partial
9
-
8
+ @category = stub :category, :exact => @exact, :partial => @partial
9
+
10
10
  @wrapper = described_class.new @category
11
11
  end
12
-
12
+
13
13
  describe "self.wrap" do
14
14
  context "index" do
15
15
  it "wraps each category" do
16
16
  index = Picky::Index.new :some_index
17
17
  index.define_category :some_category
18
-
19
- Picky::Indexed::Wrappers::ExactFirst.wrap index
20
-
18
+
19
+ Picky::Wrappers::ExactFirst.wrap index
20
+
21
21
  index.categories.categories.each do |category|
22
- category.should be_kind_of(Picky::Indexed::Wrappers::ExactFirst)
22
+ category.should be_kind_of(Picky::Wrappers::ExactFirst)
23
23
  end
24
24
  end
25
25
  it "returns the index" do
26
26
  index = Picky::Index.new :some_index
27
27
  index.define_category :some_category
28
-
28
+
29
29
  described_class.wrap(index).should == index
30
30
  end
31
31
  end
32
32
  context "category" do
33
33
  it "wraps each category" do
34
- category = stub :category, :indexed_exact => :exact, :indexed_partial => :partial
35
-
34
+ category = stub :category, :exact => :exact, :partial => :partial
35
+
36
36
  described_class.wrap(category).should be_kind_of(described_class)
37
37
  end
38
38
  end
39
39
  end
40
-
40
+
41
41
  describe 'ids' do
42
42
  it "uses first the exact, then the partial ids" do
43
43
  @exact.stub! :ids => [1,4,5,6]
44
44
  @partial.stub! :ids => [2,3,7]
45
-
45
+
46
46
  @wrapper.ids(:anything).should == [1,4,5,6,2,3,7]
47
47
  end
48
48
  end
49
-
49
+
50
50
  describe 'weight' do
51
51
  context "exact with weight" do
52
52
  before(:each) do
@@ -91,5 +91,5 @@ describe Picky::Indexed::Wrappers::ExactFirst do
91
91
  end
92
92
  end
93
93
  end
94
-
94
+
95
95
  end
@@ -4,48 +4,29 @@ describe Picky::Indexers::Base do
4
4
 
5
5
  let(:some_index_or_category) { stub :some_index_or_category, :name => 'some index or category' }
6
6
  let(:indexer) { described_class.new some_index_or_category }
7
-
7
+
8
8
  describe 'index_or_category' do
9
9
  it 'returns the right thing' do
10
10
  indexer.index_or_category.should == some_index_or_category
11
11
  end
12
12
  end
13
-
13
+
14
14
  describe 'source' do
15
15
  it 'delegates it to the index or category' do
16
16
  some_index_or_category.should_receive(:source).once.with
17
-
17
+
18
18
  indexer.source
19
19
  end
20
20
  end
21
-
21
+
22
22
  describe 'index' do
23
23
  it 'messages, then processed' do
24
24
  indexer.should_receive(:start_indexing_message).once.with.ordered
25
- indexer.should_receive(:prepare).once.with(:categories).ordered
26
25
  indexer.should_receive(:process).once.with(:categories).ordered
27
26
  indexer.should_receive(:finish_indexing_message).once.with.ordered
28
-
27
+
29
28
  indexer.index :categories
30
29
  end
31
30
  end
32
-
33
- describe 'prepare' do
34
- it 'calls a certain method on each category' do
35
- some_index_or_category.stub! :source
36
-
37
- category1 = stub :category1
38
- category2 = stub :category2
39
- category3 = stub :category3
40
-
41
- categories = [category1, category2, category3]
42
-
43
- categories.each do |category|
44
- category.should_receive(:prepare_index_directory).once.with
45
- end
46
-
47
- indexer.prepare categories
48
- end
49
- end
50
-
31
+
51
32
  end
@@ -2,37 +2,48 @@ require 'spec_helper'
2
2
 
3
3
  describe Picky::Indexes do
4
4
 
5
- before(:each) do
6
- @index = stub :some_index, :name => :some_index
7
- @indexes = described_class.instance
5
+ let(:index) { stub :some_index, :name => :some_index }
6
+
7
+ context 'with instance' do
8
+ let(:indexes) { Picky::Indexes.new }
9
+
10
+ describe 'indexes' do
11
+ it 'exists' do
12
+ lambda { indexes.indexes }.should_not raise_error
13
+ end
14
+ it 'is empty by default' do
15
+ indexes.indexes.should be_empty
16
+ end
17
+ end
8
18
  end
9
19
 
10
- describe 'indexes' do
11
- it 'exists' do
12
- lambda { @indexes.indexes }.should_not raise_error
13
- end
14
- it 'is empty by default' do
15
- @indexes.indexes.should be_empty
20
+ context 'with singleton' do
21
+ let(:indexes) { Picky::Indexes.instance }
22
+
23
+ describe 'indexes' do
24
+ it 'exists' do
25
+ lambda { indexes.indexes }.should_not raise_error
26
+ end
16
27
  end
17
- end
18
28
 
19
- describe 'clear_indexes' do
20
- it 'clears the indexes' do
21
- @indexes.register @index
29
+ describe 'clear_indexes' do
30
+ it 'clears the indexes' do
31
+ indexes.register index
22
32
 
23
- @indexes.clear_indexes
33
+ indexes.clear_indexes
24
34
 
25
- @indexes.indexes.should == []
35
+ indexes.indexes.should == []
36
+ end
26
37
  end
27
- end
28
38
 
29
- describe 'register' do
30
- it 'adds the given index to the indexes' do
31
- @indexes.clear_indexes
32
-
33
- @indexes.register @index
39
+ describe 'register' do
40
+ it 'adds the given index to the indexes' do
41
+ indexes.clear_indexes
42
+
43
+ indexes.register index
34
44
 
35
- @indexes.indexes.should == [@index]
45
+ indexes.indexes.should == [index]
46
+ end
36
47
  end
37
48
  end
38
49
 
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Picky::Indexing::Bundle do
3
+ describe Picky::Bundle do
4
4
 
5
5
  before(:each) do
6
6
  @index = Picky::Index.new :some_index
7
7
  @category = Picky::Category.new :some_category, @index
8
-
8
+
9
9
  @partial_strategy = Picky::Generators::Partial::Substring.new :from => 1
10
10
  @exact = described_class.new :some_name, @category, Picky::Backends::Memory.new, nil, @partial_strategy, nil
11
11
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Picky::Indexing::Bundle do
3
+ describe Picky::Bundle do
4
4
 
5
5
  before(:each) do
6
6
  @index = Picky::Index.new :some_index
@@ -8,13 +8,13 @@ describe Picky::Indexing::Bundle do
8
8
  @similarity = Picky::Similarity::DoubleMetaphone.new 3
9
9
  end
10
10
  let(:bundle) { described_class.new :some_name, @category, Picky::Backends::Memory.new, :some_weights, :some_partial, @similarity }
11
-
11
+
12
12
  describe 'identifier' do
13
13
  it 'is correct' do
14
14
  bundle.identifier.should == 'test:some_index:some_category:some_name'
15
15
  end
16
16
  end
17
-
17
+
18
18
  describe 'similar' do
19
19
  before(:each) do
20
20
  bundle.similarity = @similarity.generate_from( :dragon => [1,2,3], :dargon => [4,5,6] )
@@ -32,7 +32,7 @@ describe Picky::Indexing::Bundle do
32
32
  performance_of { bundle.similar(:trkn) }.should < 0.00006
33
33
  end
34
34
  end
35
-
35
+
36
36
  describe 'raise_cache_missing' do
37
37
  it 'does something' do
38
38
  expect {
@@ -40,21 +40,21 @@ describe Picky::Indexing::Bundle do
40
40
  }.to raise_error("Error: The similarity cache for test:some_index:some_category:some_name is missing.")
41
41
  end
42
42
  end
43
-
43
+
44
44
  describe 'warn_cache_small' do
45
45
  it 'warns the user' do
46
46
  bundle.should_receive(:warn).once.with "Warning: similarity cache for test:some_index:some_category:some_name smaller than 16 bytes."
47
-
47
+
48
48
  bundle.warn_cache_small :similarity
49
49
  end
50
50
  end
51
-
51
+
52
52
  describe 'identifier' do
53
53
  it 'should return a specific identifier' do
54
54
  bundle.identifier.should == 'test:some_index:some_category:some_name'
55
55
  end
56
56
  end
57
-
57
+
58
58
  describe 'initialize_index_for' do
59
59
  context 'token not yet assigned' do
60
60
  before(:each) do
@@ -77,13 +77,13 @@ describe Picky::Indexing::Bundle do
77
77
  end
78
78
  end
79
79
  end
80
-
80
+
81
81
  describe 'retrieve' do
82
82
  before(:each) do
83
83
  prepared = stub :prepared
84
84
  prepared.should_receive(:retrieve).once.and_yield ' 1234', :some_token
85
85
  bundle.stub! :prepared => prepared
86
-
86
+
87
87
  @ary = stub :ary
88
88
  inverted = stub :inverted, :[] => @ary
89
89
  bundle.stub! :inverted => inverted
@@ -94,7 +94,7 @@ describe Picky::Indexing::Bundle do
94
94
  end
95
95
  it 'should call the other methods correctly' do
96
96
  @ary.should_receive(:<<).once.with 1234
97
-
97
+
98
98
  bundle.retrieve
99
99
  end
100
100
  end
@@ -104,7 +104,7 @@ describe Picky::Indexing::Bundle do
104
104
  end
105
105
  it 'should call the other methods correctly' do
106
106
  @ary.should_receive(:<<).once.with '1234'
107
-
107
+
108
108
  bundle.retrieve
109
109
  end
110
110
  end
@@ -114,7 +114,7 @@ describe Picky::Indexing::Bundle do
114
114
  end
115
115
  it 'should call the other methods correctly' do
116
116
  @ary.should_receive(:<<).once.with 1234
117
-
117
+
118
118
  bundle.retrieve
119
119
  end
120
120
  end
@@ -123,7 +123,6 @@ describe Picky::Indexing::Bundle do
123
123
  describe 'load_from_index_file' do
124
124
  it 'should call two methods in order' do
125
125
  bundle.should_receive(:load_from_prepared_index_generation_message).once.ordered
126
- bundle.should_receive(:clear).once.ordered
127
126
  bundle.should_receive(:retrieve).once.ordered
128
127
 
129
128
  bundle.load_from_prepared_index_file
@@ -156,16 +155,16 @@ describe Picky::Indexing::Bundle do
156
155
  bundle.generate_caches_from_source
157
156
  end
158
157
  end
159
-
158
+
160
159
  describe 'dump' do
161
160
  it 'should trigger dumps' do
162
161
  bundle.stub! :timed_exclaim
163
-
162
+
164
163
  bundle.should_receive(:dump_inverted).once.with
165
164
  bundle.should_receive(:dump_weights).once.with
166
165
  bundle.should_receive(:dump_similarity).once.with
167
166
  bundle.should_receive(:dump_configuration).once.with
168
-
167
+
169
168
  bundle.dump
170
169
  end
171
170
  end
@@ -174,7 +173,7 @@ describe Picky::Indexing::Bundle do
174
173
  it "calls methods in order" do
175
174
  bundle.should_receive(:raise_unless_index_exists).once.ordered
176
175
  bundle.should_receive(:raise_unless_similarity_exists).once.ordered
177
-
176
+
178
177
  bundle.raise_unless_cache_exists
179
178
  end
180
179
  end
@@ -187,7 +186,7 @@ describe Picky::Indexing::Bundle do
187
186
  it "calls the methods in order" do
188
187
  bundle.should_receive(:warn_if_index_small).once.ordered
189
188
  bundle.should_receive(:raise_unless_index_ok).once.ordered
190
-
189
+
191
190
  bundle.raise_unless_index_exists
192
191
  end
193
192
  end
@@ -199,7 +198,7 @@ describe Picky::Indexing::Bundle do
199
198
  it "calls nothing" do
200
199
  bundle.should_receive(:warn_if_index_small).never
201
200
  bundle.should_receive(:raise_unless_index_ok).never
202
-
201
+
203
202
  bundle.raise_unless_index_exists
204
203
  end
205
204
  end
@@ -213,7 +212,7 @@ describe Picky::Indexing::Bundle do
213
212
  it "calls the methods in order" do
214
213
  bundle.should_receive(:warn_if_similarity_small).once.ordered
215
214
  bundle.should_receive(:raise_unless_similarity_ok).once.ordered
216
-
215
+
217
216
  bundle.raise_unless_similarity_exists
218
217
  end
219
218
  end
@@ -225,7 +224,7 @@ describe Picky::Indexing::Bundle do
225
224
  it "calls nothing" do
226
225
  bundle.should_receive(:warn_if_similarity_small).never
227
226
  bundle.should_receive(:raise_unless_similarity_ok).never
228
-
227
+
229
228
  bundle.raise_unless_similarity_exists
230
229
  end
231
230
  end
@@ -237,7 +236,7 @@ describe Picky::Indexing::Bundle do
237
236
  end
238
237
  it "warns" do
239
238
  bundle.should_receive(:warn_cache_small).once.with :similarity
240
-
239
+
241
240
  bundle.warn_if_similarity_small
242
241
  end
243
242
  end
@@ -247,7 +246,7 @@ describe Picky::Indexing::Bundle do
247
246
  end
248
247
  it "does not warn" do
249
248
  bundle.should_receive(:warn_cache_small).never
250
-
249
+
251
250
  bundle.warn_if_similarity_small
252
251
  end
253
252
  end
@@ -259,7 +258,7 @@ describe Picky::Indexing::Bundle do
259
258
  end
260
259
  it "warns" do
261
260
  bundle.should_receive(:raise_cache_missing).never
262
-
261
+
263
262
  bundle.raise_unless_similarity_ok
264
263
  end
265
264
  end
@@ -269,12 +268,12 @@ describe Picky::Indexing::Bundle do
269
268
  end
270
269
  it "does not warn" do
271
270
  bundle.should_receive(:raise_cache_missing).once.with :similarity
272
-
271
+
273
272
  bundle.raise_unless_similarity_ok
274
273
  end
275
274
  end
276
275
  end
277
-
276
+
278
277
  describe 'initialization' do
279
278
  it 'should initialize the index correctly' do
280
279
  bundle.inverted.should == {}
@@ -298,5 +297,5 @@ describe Picky::Indexing::Bundle do
298
297
  bundle.similarity_strategy.should == @similarity
299
298
  end
300
299
  end
301
-
300
+
302
301
  end
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Picky::Sources::Wrappers::Base do
4
-
3
+ describe Picky::Wrappers::Sources::Base do
4
+
5
5
  before(:each) do
6
6
  @source = stub :source
7
7
  end
8
-
8
+
9
9
  context "with backend" do
10
10
  it "doesn't fail" do
11
11
  lambda { described_class.new(@source) }.should_not raise_error
@@ -15,17 +15,17 @@ describe Picky::Sources::Wrappers::Base do
15
15
  end
16
16
  it "delegates harvest" do
17
17
  @source.should_receive(:harvest).once.with :some_category
18
-
18
+
19
19
  @wrapper.harvest :some_category
20
20
  end
21
21
  it "delegates take_snapshot" do
22
22
  @source.should_receive(:take_snapshot).once.with :some_index
23
-
23
+
24
24
  @wrapper.take_snapshot :some_index
25
25
  end
26
26
  it "delegates connect_backend" do
27
27
  @source.should_receive(:connect_backend).once.with # nothing
28
-
28
+
29
29
  @wrapper.connect_backend
30
30
  end
31
31
  end
@@ -34,5 +34,5 @@ describe Picky::Sources::Wrappers::Base do
34
34
  lambda { described_class.new }.should raise_error(ArgumentError)
35
35
  end
36
36
  end
37
-
37
+
38
38
  end