Sha256: 538ea0e333bcb333cacde194af724ce03d0f012f199343542fb2f3c53ff7d853

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

require File.join(File.dirname(__FILE__), %w[.. spec_helper])
require 'chronic'

describe Wackamole::User do
  before( :all ) do
    Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. config test.yml]), 'test' )
    Wackamole::Control.connection.should_not be_nil
    Wackamole::Control.db( "mole_fred_test_mdb" )
  end
  
  it "should paginate a user collection correctly" do
    cltn = Wackamole::User.paginate_tops( {}, 1, 2 )
    cltn.total_entries.should == 7
    cltn.size.should == 2
    cltn.total_pages.should == 4
  end
  
  describe "indexes" do
    before :all do
      @cltn = Wackamole::User.users_cltn
      @cltn.should_not be_nil
      @cltn.drop_indexes
    end
    
    it "should set up indexes correctly" do
      indexes = @cltn.index_information
      indexes.should have(1).item  
      count = Wackamole::User.ensure_indexes!  
      count.should == 1
      indexes = @cltn.index_information
      indexes.should have(2).items
    end
    
    it "should do nothing if indexes are already present" do
      indexes = @cltn.index_information
      indexes.should have(2).items   
      count = Wackamole::User.ensure_indexes!
      count.should == 1
      indexes = @cltn.index_information
      indexes.should have(2).items      
    end
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wackamole-0.0.8 spec/models/user_spec.rb
wackamole-0.0.7 spec/models/user_spec.rb
wackamole-0.0.6 spec/models/user_spec.rb
wackamole-0.0.5 spec/models/user_spec.rb
wackamole-0.0.4 spec/models/user_spec.rb
wackamole-0.0.3 spec/models/user_spec.rb
wackamole-0.0.2 spec/models/user_spec.rb
wackamole-0.0.1 spec/models/user_spec.rb