Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 31 lines (25 sloc) 0.946 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
require File.expand_path(File.dirname(__FILE__) + '/support/integration_helper')

LightMongo.slow_serialization = true

class Article
  include LightMongo::Document

  attr_reader :page_length
  index :title
  index :abstract, :as => :precis
end

describe 'Indexing an attribute' do
  before(:each) do
    @geology_article = Article.create(:title => 'Fluid Physics in Geology',
                                      :abstract => 'A study in geological fluid physics',
                                      :page_length => 367)
  end
  
  context "where an alias is not given" do
    it "creates a finder using the key name" do
      Article.find_by_title('Fluid Physics in Geology').first.should == @geology_article
    end
  end
  
  context "where an alias has been given" do
    it "creates a finder using the alias name" do
      Article.find_by_precis('A study in geological fluid physics').first.should == @geology_article
    end
  end
end
Something went wrong with that request. Please try again.