Sha256: 4ad9699336a301aa1711e2c4a8b3ca91c6bc1cb0522c4d53aa110cf709d1c108

Contents?: true

Size: 1.67 KB

Versions: 23

Compression:

Stored size: 1.67 KB

Contents

require 'logger'

require 'pod4'
require 'pod4/param'
require 'pod4/errors'


describe Pod4 do

  # Magically replaces the real Param module
  let(:param) { class_double(Pod4::Param).as_stubbed_const }

  after(:all) { Param.reset }


  it 'has a version' do
    expect( Pod4::VERSION ).not_to be_nil
  end
  ##


  describe "Pod4.set_logger" do

    it "calls Param.set" do
      l = Logger.new(STDOUT)
      expect(param).to receive(:set).with(:logger, l)
      Pod4.set_logger(l)
    end

  end
  ##


  describe 'Pod4.logger' do

    it 'returns the logger as set' do
      l = Logger.new(STDOUT)
      Pod4.set_logger(l)

      expect( Pod4.logger ).to eq l
    end

    it 'still works if no-one set the logger' do
      expect{ Pod4.logger }.not_to raise_exception
      expect( Pod4.logger ).to be_a_kind_of Logger
    end

  end
  ##
  

  describe 'Pod4::NotImplemented' do
    it 'is an exception' do
      expect( Pod4::NotImplemented ).not_to be_nil
      expect( Pod4::NotImplemented.ancestors ).to include Exception
    end
  end
  ##


  describe 'Pod4::Pod4Error' do
    it 'is an exception' do
      expect( Pod4::Pod4Error ).not_to be_nil
      expect( Pod4::Pod4Error.ancestors ).to include Exception
    end
  end
  ##


  describe 'Pod4::DatabaseError' do
    it 'is an exception based on Pod4Error' do
      expect( Pod4::DatabaseError ).not_to be_nil
      expect( Pod4::DatabaseError.ancestors ).to include Pod4::Pod4Error
    end
  end
  ##


  describe 'Pod4::ValidationError' do
    it 'is an exception based on Pod4Error' do
      expect( Pod4::ValidationError ).not_to be_nil
      expect( Pod4::ValidationError.ancestors ).to include Pod4::Pod4Error
    end
  end
  ##


end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
pod4-0.6.4 spec_common/pod4_spec.rb
pod4-0.6.3 spec/pod4_spec.rb
pod4-0.6.2 spec/pod4_spec.rb