Sha256: e3a1d87e5f46b2576ef73aeefede1101bbe25e599a263b9b71a6811646f7683a
Contents?: true
Size: 629 Bytes
Versions: 10
Compression:
Stored size: 629 Bytes
Contents
require 'spec_helper' describe Grape::Validations::RegexpValidator do module ValidationsSpec module RegexpValidatorSpec class API < Grape::API default_format :json params do requires :name, :regexp => /^[a-z]+$/ end get do end end end end def app ValidationsSpec::RegexpValidatorSpec::API end it 'refuses invalid input' do get '/', :name => "invalid name" last_response.status.should == 400 end it 'accepts valid input' do get '/', :name => "bob" last_response.status.should == 200 end end
Version data entries
10 entries across 10 versions & 1 rubygems