Skip to content

Commit

Permalink
some fixes about unnamed metas
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Andreev committed Apr 29, 2008
1 parent 224495e commit ecd941f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/strokedb/views/store_ext.rb
Expand Up @@ -25,7 +25,7 @@ def update_views!(doc) #:nodoc:
view.update(doc)
end
doc.metas.each do |meta|
views = @registered_views[meta.name]
views = @registered_views[meta['name']]
if views
views.each do |view|
view.update(doc)
Expand Down
21 changes: 17 additions & 4 deletions spec/lib/strokedb/document/document_spec.rb
Expand Up @@ -609,24 +609,37 @@



describe "Document with single meta" do
describe "Document with a single meta" do

before(:each) do
@store = setup_default_store
setup_default_store
setup_index
@meta = Document.create!(@store)
Object.send!(:remove_const, "SomeMeta") if defined? ::SomeMeta
::SomeMeta = Meta.new(@store)
@meta = ::SomeMeta
# FIXME: This modifies metameta.
@document = Document.create!(@store, :meta => @meta)
# This doesn't modify:
# @document = @meta.create!(@store)

# p @meta.document.meta
# p @document.meta.meta
# p @meta.create!.meta.meta
end

it "but specified within array should return single meta which should be mutable" do
pending "BUG"
@document = Document.create!(@store, :meta => [@meta])
@document.meta.should == @meta
# p @meta.document.meta
# p @document.meta.meta
@document.meta.should == @meta.document
@document.meta.should be_mutable
end

it "should return single meta which should be mutable" do
@document.meta.should == @meta
pending "BUG"
@document.meta.should == @meta.document
@document.meta.should be_mutable
end

Expand Down
2 changes: 1 addition & 1 deletion spec/lib/strokedb/sync/diff_spec.rb
Expand Up @@ -96,7 +96,7 @@
Slot1Diff.should_receive(:diff).with("abcdef","abcdef1").any_number_of_times.and_return("1")
Slot1Diff.should_receive(:patch).with("abcdef","1").any_number_of_times.and_return("abcdef1")


# FIXME: meta without a name!
@meta = Document.create! :diff_strategy_slot1 => strategy # TODO: fix this spec, it willn't care if I say strategy_slot1

@from = Document.create! :slot1 => "abcdef", :meta => @meta
Expand Down

0 comments on commit ecd941f

Please sign in to comment.