Sha256: f38320641267785ec9b8af9a2a353232e426d6bccb8cadfef8cf08c69e2a63df
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
require 'spec_helper' module Diagnostics describe Check do describe '.add' do it 'adds a check' do described_class.add :foo Diagnostics.should have(1).checks end end describe '.find' do let!(:check) { described_class.add :foo } it 'finds the check by name' do described_class.find(:foo).should eq(check) end end describe 'status predicate methods' do let(:check) do described_class.new(:foo) do |c| c.passed { true } c.warning { false } c.failed { false } end end describe '#passed?' do specify { check.should be_passed } end describe '#warning?' do specify { check.should_not be_warning } end describe '#failed?' do specify { check.should_not be_failed } end end describe '#status' do [:passed, :warning, :failed, :none].each do |status| context "with #{status}" do let(:check) { create_check(status) } specify { check.status.should eq(status) } end end def create_check(status = nil) described_class.new(:foo) do |c| c.passed { status == :passed } c.warning { status == :warning } c.failed { status == :failed } end end end describe '#data' do context 'given a block' do it 'yields a DataGroup instance' do described_class.new(:foo).data do |d| d.should be_an_instance_of(Diagnostics::DataGroup) end end end context 'given no block' do it 'returns a DataGroup instance' do data = described_class.new(:foo).data data.should be_an_instance_of(Diagnostics::DataGroup) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
diagnostics-0.0.2 | spec/diagnostics/check_spec.rb |