Sha256: 558c39e3492abaaeaffdc64ceb091013b601a4d52334cd544719e57f78d9449e

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

require 'spec_helper'

describe Grape::Exceptions::Validation do
  it 'fails when params are missing' do
    expect { Grape::Exceptions::Validation.new(message: 'presence') }.to raise_error(RuntimeError, 'Params are missing:')
  end
  context 'when message is a symbol' do
    it 'stores message_key' do
      expect(Grape::Exceptions::Validation.new(params: ['id'], message: :presence).message_key).to eq(:presence)
    end
  end
  context 'when message is a String' do
    it 'does not store the message_key' do
      expect(Grape::Exceptions::Validation.new(params: ['id'], message: 'presence').message_key).to eq(nil)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-0.17.0 spec/grape/exceptions/validation_spec.rb