supernova 0.4.16 → 0.4.17

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.16
1
+ 0.4.17
@@ -71,6 +71,15 @@ class Supernova::SolrIndexer
71
71
  self.ids ||= :all
72
72
  end
73
73
 
74
+ def ids=(new_ids)
75
+ @ids = new_ids
76
+ @cached = {}
77
+ end
78
+
79
+ def cached
80
+ @cached ||= {}
81
+ end
82
+
74
83
  def debug(message)
75
84
  response = true
76
85
  time = Benchmark.realtime do
@@ -235,6 +235,34 @@ describe Supernova::SolrIndexer do
235
235
  end
236
236
  end
237
237
 
238
+ let(:index) { CustomSolrIndex.new }
239
+
240
+ describe "#ids=" do
241
+ it "sets the ids array" do
242
+ index.ids = [2, 4]
243
+ index.ids.should == [2, 4]
244
+ end
245
+
246
+ it "sets the @cached array to nil" do
247
+ index.instance_variable_set("@cached", { :a => 1 })
248
+ index.ids = [2, 4]
249
+ index.instance_variable_get("@cached").should == {}
250
+ end
251
+ end
252
+
253
+ describe "#cached" do
254
+ it "returns the instance variable when set" do
255
+ index.instance_variable_set("@cached", { :a => 1 })
256
+ index.cached.should == { :a => 1 }
257
+ end
258
+
259
+ it "returns and initializes a new cached hash when nil" do
260
+ index.instance_variable_set("@cached", nil)
261
+ index.cached.should == {}
262
+ index.instance_variable_get("@cached").should == {}
263
+ end
264
+ end
265
+
238
266
  describe "#map_hash_keys_to_solr" do
239
267
  class CustomSolrIndex < Supernova::SolrIndexer
240
268
  has :offer_id, :type => :integer
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{supernova}
8
- s.version = "0.4.16"
8
+ s.version = "0.4.17"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tobias Schwab"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supernova
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
4
+ hash: 45
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 16
10
- version: 0.4.16
9
+ - 17
10
+ version: 0.4.17
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Schwab