spec/integration/mongoid/i18n_spec.rb in mongoid_i18n-0.1.6 vs spec/integration/mongoid/i18n_spec.rb in mongoid_i18n-0.1.7
- old
+ new
@@ -138,6 +138,30 @@
end
it "should contain the embedded documents" do
@entry.sub_entries.criteria.instance_variable_get("@documents").should == @sub_entries
end
+end
+
+describe Mongoid::I18n, 'criteria on embeds_one association' do
+ before do
+ class Entry
+ embeds_one :sub_entry
+ end
+
+ class SubEntry
+ include Mongoid::Document
+ include Mongoid::I18n
+ localized_field :subtitle
+ embedded_in :entry, :inverse_of => :sub_entries
+ end
+ @entry = Entry.new
+ end
+
+ it "should store the title in the right locale" do
+ @entry.create_sub_entry(:subtitle => "Oxford Street")
+
+ @entry.reload
+
+ @entry.sub_entry.subtitle.should == 'Oxford Street'
+ end
end
\ No newline at end of file