Sha256: 4da3a1a11df51f534a8388e9614394fbcd7d464d0c4bcdaba02bfabed87a179f

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

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

describe Wackamole::Feature 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_app1_test_mdb" )
  end
  
  it "retrieve an app info correctly" do
    app_info = Wackamole::Feature.get_app_info
    app_info.should_not be_nil
    app_info.should have(2).items
    app_info[:app_name].should == "app1"
    app_info[:stage].should  == "test"
  end
  
  it "should paginate features correctly" do
    cltn = Wackamole::Feature.paginate_tops( {}, 1, 5 )
    cltn.total_entries.should == 6
    cltn.size.should          == 5
    cltn.total_pages.should   == 2  
  end
  
  describe "indexes" do
    before :all do
      @cltn = Wackamole::Feature.features_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::Feature.ensure_indexes!  
      count.should == 3
      indexes = @cltn.index_information
      indexes.should have(3).items
    end
    
    it "should do nothing if indexes are already present" do
      indexes = @cltn.index_information
      indexes.should have(3).items   
      count = Wackamole::Feature.ensure_indexes!
      count.should == 1
      indexes = @cltn.index_information
      indexes.should have(3).items      
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wackamole-0.0.9 spec/wackamole/models/feature_spec.rb