spec/rackamole/store/mongo_db_spec.rb in rackamole-0.0.6 vs spec/rackamole/store/mongo_db_spec.rb in rackamole-0.0.7
- old
+ new
@@ -11,13 +11,14 @@
:logger => Rackamole::Logger.new( :file_name => $stdout, :log_level => 'info' ) )
@db = @store.database
end
before( :each ) do
- @store.reset!
+ @store.send( :reset! )
@args = OrderedHash.new
+ @args[:type] = Rackamole.feature
@args[:app_name] = "Test app"
@args[:environment] = :test
@args[:perf_issue] = false
@args[:ip] = "1.1.1.1"
@args[:browser] = "Ibrowse"
@@ -37,16 +38,16 @@
@store.logs.count.should == 1
feature = @store.features.find_one()
feature.should_not be_nil
feature['app'].should == 'Test app'
- feature['env'].should == :test
+ feature['env'].should == 'test'
feature['ctx'].should == '/fred'
log = @store.logs.find_one()
log.should_not be_nil
- log['typ'].should == Rackamole::Store::MongoDb::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/'
@@ -75,11 +76,11 @@
feature['act'].should == 'blee'
feature['ctx'].should be_nil
log = @store.logs.find_one()
log.should_not be_nil
- log['typ'].should == Rackamole::Store::MongoDb::FEATURE
+ log['typ'].should == Rackamole.feature
log['pat'].should_not be_nil
end
it "should reuse an existing feature" do
@store.mole( @args )
@@ -88,37 +89,40 @@
@store.features.count.should == 1
@store.logs.count.should == 2
end
it "should mole perf correctly" do
- @args[:performance] = true
+ @args[:type] = Rackamole.perf
@store.mole( @args )
@store.features.count.should == 1
@store.logs.count.should == 1
feature = @store.features.find_one()
feature.should_not be_nil
log = @store.logs.find_one()
log.should_not be_nil
- log['typ'].should == Rackamole::Store::MongoDb::PERFORMANCE
+ log['typ'].should == Rackamole.perf
end
it 'should mole an exception correctly' do
+ @args[:type] = Rackamole.fault
@args[:stack] = ['fred']
+ @args[:fault] = "Oh Snap!"
@store.mole( @args )
@store.features.count.should == 1
@store.logs.count.should == 1
feature = @store.features.find_one()
feature.should_not be_nil
log = @store.logs.find_one()
log.should_not be_nil
- log['typ'].should == Rackamole::Store::MongoDb::EXCEPTION
- log['sta'].should == ['fred']
+ log['typ'].should == Rackamole.fault
+ log['sta'].should == ['fred']
+ log['msg'].should == 'Oh Snap!'
end
it 'should keep count an similar exceptions or perf issues' do
pending "NYI"
end
\ No newline at end of file