Sha256: 02a651d6deb8547cef922e7c2b2dd1f05071f3d11b6f68473c3b16fc12d12011
Contents?: true
Size: 784 Bytes
Versions: 11
Compression:
Stored size: 784 Bytes
Contents
require 'spec_helper' include Restspec::Schema::Types describe IntegerType do let(:type) { IntegerType.new } let(:attribute) { double } describe '#example_for' do it 'returns a number' do 10.times do expect(type.example_for(attribute)).to be_a_kind_of(Fixnum) end end end describe '#valid?' do it 'only validates integer values' do expect(type.valid?(attribute, 1)).to eq(true) expect(type.valid?(attribute, -10)).to eq(true) expect(type.valid?(attribute, -10.5)).to eq(false) expect(type.valid?(attribute, '10.5')).to eq(false) expect(type.valid?(attribute, '10')).to eq(false) expect(type.valid?(attribute, 'no')).to eq(false) expect(type.valid?(attribute, nil)).to eq(false) end end end
Version data entries
11 entries across 11 versions & 1 rubygems