spec/rackamole/store/mongo_db_spec.rb in rackamole-0.1.0 vs spec/rackamole/store/mongo_db_spec.rb in rackamole-0.1.1

- old
+ new

@@ -1,11 +1,13 @@ require File.join(File.dirname(__FILE__), %w[.. .. spec_helper]) +require 'chronic' describe Rackamole::Store::MongoDb do describe "#mole" do before( :all ) do + @now = Chronic.parse( "11/27/2009" ) @store = Rackamole::Store::MongoDb.new( :host => 'localhost', :port => 27017, :database => 'test_mole_mdb', :logger => Rackamole::Logger.new( :file_name => $stdout, :log_level => 'info' ) ) @@ -28,11 +30,11 @@ @args[:url] = "http://test_me/" @args[:path] = "/fred" @args[:method] = 'GET' @args[:params] = { :blee => "duh".to_json } @args[:session] = { :fred => 10.to_json } - @args[:created_at] = Time.now.utc + @args[:created_at] = @now.utc end it "should mole a context based feature correctly" do @store.mole( @args ) @store.features.count.should == 1 @@ -44,24 +46,34 @@ feature['env'].should == 'test' feature['ctx'].should == '/fred' log = @store.logs.find_one() log.should_not be_nil - log['typ'].should == Rackamole.feature + log['typ'].should == Rackamole.feature log['fid'].should_not be_nil log['par'].should == { 'blee' => 'duh'.to_json } log['ip'].should == '1.1.1.1' log['bro'].should == 'Ibrowse' log['url'].should == 'http://test_me/' log['met'].should == 'GET' log['ses'].should == { 'fred' => '10' } - log['una'].should == 'Fernand' - log['uid'].should == 100 + log['uid'].should_not be_nil log['rti'].should == 1.0 - log['did'].should_not be_nil - log['tid'].should_not be_nil + log['did'].should == '20091127' + log['tid'].should == '190000' - @store.features.find_one( Mongo::ObjectID.from_string( log['fid'] ) )['app'].should == 'Test app' + feature = @store.features.find_one( log['fid'] ) + feature.should_not be_nil + feature['app'].should == 'Test app' + feature['env'].should == 'test' + feature['ctx'].should == '/fred' + feature['did'].should == '20091127' + + user = @store.users.find_one( log['uid'] ) + user.should_not be_nil + user['una'].should == "Fernand" + user['uid'].should == 100 + user['did'].should == '20091127' end it "should mole a rails feature correctly" do @args[:path] = '/fred/blee/duh' @args[:route_info] = { :controller => 'fred', :action => 'blee', :id => 'duh' } \ No newline at end of file