Skip to content

Commit

Permalink
Merge pull request mongoid#24 from DanielVartanov/master
Browse files Browse the repository at this point in the history
Additional regression tests
  • Loading branch information
mauriciozaffari committed Jun 29, 2011
2 parents 28f7428 + 165cde2 commit f4bb8e6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/mongoid_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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

0 comments on commit f4bb8e6

Please sign in to comment.