Sha256: 2be6700e2a6072f895e4ff60ce7e2f5ba583a8d8fe382778ef9dd8e6aa8cf633
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' module SoulmateRails class User < SuperModel::Base include ModelAdditions autocomplete :name, :score => :id end describe ModelAdditions do context 'single autocomplete' do before :each do @user = User.create(:name => 'Dhruva Sagar') end it 'should successfully search by name' do users = User.search_by_name('dhruv') user = users.first user.should eq(@user) end end context 'multiple autocompletes' do before :each do # Define another autocomplete for country User.autocomplete(:country, :score => :id) @user = User.create(:name => 'Dhruva Sagar', :country => 'India') end it 'should successfully search by name as well as country' do users = User.search_by_name('dhr') user = users.first user.should eq(@user) users = User.search_by_country('ind') user = users.first user.should eq(@user) end end after :each do User.destroy_all end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
soulmate_rails-0.2.0.alpha | spec/soulmate_rails/model_additions_spec.rb |