Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensure source is cleared as well.

In case keys have been removed database side.
  • Loading branch information...
commit 00c1b36a1425c240424361d7cc8688a7d28b3985 1 parent baa538c
@jnunemaker authored
View
2  lib/flipper/adapters/mongo/document.rb
@@ -68,9 +68,9 @@ def source
def load
@loaded = true
+ @source.clear
@source.update @collection.find_one(@criteria) || {}
end
-
end
end
end
View
3  spec/flipper/adapters/mongo/document_spec.rb
@@ -48,6 +48,7 @@ def document
describe "#read" do
context "existing key" do
before do
+ source['baz'] = 'wick'
collection.update(criteria, {'$set' => {'foo' => 'bar'}}, options)
@result = subject.read('foo')
end
@@ -56,7 +57,7 @@ def document
@result.should eq('bar')
end
- it "loads source hash" do
+ it "clears and loads source hash" do
source.should eq({
'_id' => id,
'foo' => 'bar',
Please sign in to comment.
Something went wrong with that request. Please try again.