Sha256: 57f3ad04f7c7d1ba8ecd4fc6be54f455030454fdaff794e78efff8eb38bd57f6
Contents?: true
Size: 934 Bytes
Versions: 3
Compression:
Stored size: 934 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "MongoDoc::ParentProxy" do class Parent def path_to_root(attrs) attrs end end before do @parent = Parent.new @assoc_name = 'association' end subject do MongoDoc::ParentProxy.new(@parent, @assoc_name) end it "has the association name" do should respond_to(:assoc_name) end it "has a parent" do should respond_to(:_parent) end it "requires a parent" do expect do MongoDoc::ParentProxy.new(nil, @assoc_name) end.should raise_error end it "requires an association name" do expect do MongoDoc::ParentProxy.new(@parent, nil) end.should raise_error end it "inserts the association name the path_to_root" do subject.path_to_root({:name1 => 'value1', :name2 => 'value2'}).should == {"#{@assoc_name}.name1" => 'value1', "#{@assoc_name}.name2" => "value2"} end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongodoc-0.1.2 | spec/parent_proxy_spec.rb |
mongodoc-0.1.1 | spec/parent_proxy_spec.rb |
mongodoc-0.1.0 | spec/parent_proxy_spec.rb |