Sha256: b28904f50dba6170dbf7883ba13d5a3c6fa475a27772e03236d4bd21817ca390

Contents?: true

Size: 666 Bytes

Versions: 3

Compression:

Stored size: 666 Bytes

Contents

require 'spec_helper'

describe Mongoid::I18n::LocalizedCriteria do
  describe "where" do
    before do
      @title = Mongoid::Field.new(:title, :type => Mongoid::I18n::LocalizedField)
      @published = Mongoid::Field.new(:published, :type => Boolean)
      klass = stub(:fields => {'title' => @title, 'published' => @published})
      @criteria = Mongoid::I18n::LocalizedCriteria.new(klass)
      @criteria.where(:title.in => ['Title'], :published => true)
    end
    
    it "should expand fields that are LocalizedFields" do
      @criteria.instance_variable_get("@selector").should == {'title.en' => {'$in' => ['Title']}, :published => true}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid_i18n-0.1.8 spec/unit/mongoid/i18n/localized_criteria_spec.rb
mongoid_i18n-0.1.7 spec/unit/mongoid/i18n/localized_criteria_spec.rb
mongoid_i18n-0.1.6 spec/unit/mongoid/i18n/localized_criteria_spec.rb