spec/grape/exceptions/validation_spec.rb in grape-1.6.0 vs spec/grape/exceptions/validation_spec.rb in grape-1.6.1
- old
+ new
@@ -2,18 +2,20 @@
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(ArgumentError, /missing keyword:.+?params/)
+ expect { described_class.new(message: 'presence') }.to raise_error(ArgumentError, /missing keyword:.+?params/)
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)
+ expect(described_class.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)
+ expect(described_class.new(params: ['id'], message: 'presence').message_key).to eq(nil)
end
end
end