From 165cde26b3fbe296c1f0376bfb450dbd570bc4e0 Mon Sep 17 00:00:00 2001 From: Daniel Vartanov Date: Wed, 29 Jun 2011 11:55:05 +0600 Subject: [PATCH] Additional regression tests --- spec/mongoid_search_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/mongoid_search_spec.rb b/spec/mongoid_search_spec.rb index 19eedae..5669066 100644 --- a/spec/mongoid_search_spec.rb +++ b/spec/mongoid_search_spec.rb @@ -30,6 +30,18 @@ end end + context "when references are nil" do + context "when instance is being created" do + it "should not complain about method missing" do + lambda { Product.create! }.should_not raise_error + end + end + + subject { Product.create :brand => "Apple", :name => "iPhone" } + + its(:_keywords) { should == ["apple", "iphone"] } + end + it "should set the _keywords field for array fields also" do @product.attrs = ['lightweight', 'plastic', :red] @product.save! @@ -140,4 +152,6 @@ it 'should have a class method to index all documents keywords' do Product.index_keywords!.should_not include(false) end + + end