Sha256: 7c895cae267a84cd10459b7c6d3e14ab7731d85e2378ad1fcc201e2aed2e0d6e

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

require File.expand_path('../spec_helper', __FILE__)

describe IsItWorking::Status do
  
  let(:status){ IsItWorking::Status.new(:test) }
  
  it "should have a name" do
    status.name.should == :test
  end
  
  it "should have errors" do
    status.fail("boom")
    status.should_not be_success
    status.messages.size.should == 1
    status.messages.first.should_not be_ok
    status.messages.first.state.should == :fail
    status.messages.first.message.should == "boom"
  end
  
  it "should have successes" do
    status.ok("wow")
    status.should be_success
    status.messages.first.state.should == :ok
    status.messages.size.should == 1
    status.messages.first.should be_ok
    status.messages.first.message.should == "wow"
  end

  it "should have successes and infos" do
    status.ok("wow")
    status.info("fyi")
    status.should be_success
    status.messages.each { |x| x.should be_ok }
    status.messages.last.state.should == :info
  end
  
  it "should have both errors and successes" do
    status.fail("boom")
    status.ok("wow")
    status.should_not be_success
    status.messages.size.should == 2
    status.messages.first.should_not be_ok
    status.messages.first.message.should == "boom"
    status.messages.last.should be_ok
    status.messages.last.message.should == "wow"
  end
  
  it "should have a time" do
    status.time.should == nil
    status.time = 0.1
    status.time.should == 0.1
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
is_it_working-cbeer-1.0.16 spec/status_spec.rb
is_it_working-cbeer-1.0.15 spec/status_spec.rb
is_it_working-cbeer-1.0.14 spec/status_spec.rb
is_it_working-cbeer-1.0.13 spec/status_spec.rb
is_it_working-cbeer-1.0.12 spec/status_spec.rb
is_it_working-cbeer-1.0.11 spec/status_spec.rb