Sha256: fbff6f43dd02722da541b55d513904fa0727ace86ff477c9c5e1926c2f6c8256
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
require File.join(File.dirname(__FILE__), %w[.. .. spec_helper]) require 'chronic' describe Wackamole::Mission do before :all do Wackamole::Control.init_config( File.join(File.dirname(__FILE__), %w[.. .. config test.yml]) ) Wackamole::Control.current_db( "test", "app1", "test", true ) now = Time.now-24*60*60 @test_time = Chronic.parse( "%d/%2d/%2d 00:00:01" % [now.year,now.month,now.day] ) # @test_time = Chronic.parse( "2010/01/01 01:00:00" ).utc end describe '#to_type_name' do it "should convert a type to a name correctly" do %w[feature perf fault].each do |type| name = Wackamole::Mission.to_type_name( Rackamole.send( type ) ) name.should == "#{type}s" end end it "should raise an error if a type is invalid" do lambda { Wackamole::Mission.to_type_name( "fred" ) }.should raise_error( /Invalid mole log type `fred/ ) end end it "should pick up an app pulse correctly" do zones = Wackamole::Mission.pulse( @test_time ) zones.should have(1).items apps = zones['test'] apps.should have(2).items expected = {'to_date' => [7,5,3], 'today' => [3,2,1] } %w(to_date today).each do |p| %w(app1 app2).each do |app| [0, 1, 2].each do |type| zones['test'][app]['test'][p.to_sym][type].should == expected[p][type] end end end # %w(app1 app2).each do |app| # expected = [3,2,1] # [0, 1, 2].each do |type| # pulse[:last_tick][app]["test"][type].should == expected[type] # end # end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wackamole-0.1.3 | spec/wackamole/models/mission_spec.rb |
wackamole-0.1.2 | spec/wackamole/models/mission_spec.rb |