Sha256: 53ce7f5f943799fed71fd09e0ae22d2e206b0eb05108a475a0181a913abf838b

Contents?: true

Size: 563 Bytes

Versions: 3

Compression:

Stored size: 563 Bytes

Contents

require 'spec_helper'

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

    expect(error.property).to eq(:prop)
    expect(error.message).to eq('message')
  end

  it 'can coerce to a string' do
    error = create_error
    expect(error.to_s).to eq('prop message')
  end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
valcro-0.2.0 spec/error_spec.rb
valcro-0.1.1 spec/error_spec.rb
valcro-0.1 spec/error_spec.rb