Sha256: 7d19d89f4593c5eac11689a224e5fb675e13b712f0e416a8bf9520bcc9318648
Contents?: true
Size: 1.15 KB
Versions: 1
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
status_cat-0.0.8 | spec/lib/status_cat/checkers/base_spec.rb |