Sha256: 20fd65106ee3a2ac23c57a81faa6dec27372c8666966708d12273117586ad579

Contents?: true

Size: 842 Bytes

Versions: 15

Compression:

Stored size: 842 Bytes

Contents

require 'spec_helper'

describe Notu::Error do

  let(:error) { Notu::Error.new('BAM!') }
  let(:original) { StandardError.new('BIM!') }

  describe '#message' do

    it 'is message set at initialization' do
      expect(error.message).to eq('BAM!')
    end

    it 'message is squished' do
      expect(Notu::Error.new(" hello  \n world").message).to eq('hello world')
    end

    it 'default one if blank' do
      expect(Notu::Error.new(" ").message).to eq('Notu::Error')
    end

  end

  describe '#original' do

    it 'is nil by default' do
      expect(error.original).to be_nil
    end

    it 'is exception given at initialization' do
      expect(Notu::Error.new(original).original).to be(original)
    end

    it 'sets message from original' do
      expect(Notu::Error.new(original).message).to eq('BIM!')
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
notu-1.0.2 spec/notu/error_spec.rb
notu-1.0.1 spec/notu/error_spec.rb
notu-1.0.0 spec/notu/error_spec.rb
notu-0.3.1 spec/notu/error_spec.rb
notu-0.3.0 spec/notu/error_spec.rb
notu-0.2.2 spec/notu/error_spec.rb
notu-0.2.1 spec/notu/error_spec.rb
notu-0.2.0 spec/notu/error_spec.rb
notu-0.1.6 spec/notu/error_spec.rb
notu-0.1.5 spec/notu/error_spec.rb
notu-0.1.4 spec/notu/error_spec.rb
notu-0.1.3 spec/notu/error_spec.rb
notu-0.1.2 spec/notu/error_spec.rb
notu-0.1.1 spec/notu/error_spec.rb
notu-0.1.0 spec/notu/error_spec.rb