Sha256: a35128fc7cc94407e0f50d6c4b454996ef74973775342927709777b3793131dc

Contents?: true

Size: 543 Bytes

Versions: 2

Compression:

Stored size: 543 Bytes

Contents

require 'spec_helper'

describe Valcro::Error do
  it 'has a property and a message' do
    error = create_error(:prop, 'message')

    error.property.should == :prop
    error.message.should == 'message'
  end

  it 'can coerce to a string' do
    error = create_error
    error.to_s.should == 'prop message'
  end

  it 'does not include property if it is base' do
    error = create_error(:base)
    error.to_s.should == 'message'
  end

  def create_error(prop = :prop, message = 'message')
    Valcro::Error.new(prop, message)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
valcro-0.0.2 spec/error_spec.rb
valcro-0.0.1 spec/error_spec.rb