Sha256: e9672609683e2c8c9c963afe9418d715ab8df6204d3a749bc539bc98d10eca03
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe StatusCat::Checkers::Base do let( :checker ) { StatusCat::Checkers::Base.new } describe '#name' do it 'generates a symbolized class name' do checker.name.should be( :base ) end end describe 'attributes' do it 'has value and status readers' do checker.value.should be_nil checker.status.should be_nil end end describe '#to_s' do before( :each ) do checker.stub( :value ).and_return( 'secret' ) checker.stub( :status ).and_return( 'fail' ) end it 'generates a string' do checker.to_s.should eql( "base | secret | fail\n" ) end it 'accepts a format' do checker.to_s( '%s * %s * %s' ).should eql( 'base * secret * fail' ) end end describe '#fail_on_exception' do it 'returns an exception if raised from the block given' do error = 'test' status = checker.send( :fail_on_exception ) { raise error } status.to_s.should eql( error ) end it 'returns the results of the block when there is no exception' do status = checker.send( :fail_on_exception ) { true } status.should be_true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
status_cat-0.1.0 | spec/lib/status_cat/checkers/base_spec.rb |
status_cat-0.0.9 | spec/lib/status_cat/checkers/base_spec.rb |