Sha256: 7c6bae832651ffbf224cd174c22e8ff3f0e782b99ac458e96bb3410e90b6bb02

Contents?: true

Size: 663 Bytes

Versions: 15

Compression:

Stored size: 663 Bytes

Contents

require 'spec_helper'

include Restspec::Schema::Types

describe NullType do
  describe '#example_for' do
    subject { NullType.new.example_for(double) }

    it { should eq(nil) }
  end

  describe 'valid?' do
    let(:type) { NullType.new }

    it 'only is true when nil' do
      expect(type.valid?(double, nil)).to eq(true)
      expect(type.valid?(double, false)).to eq(false)
      expect(type.valid?(double, '')).to eq(false)
      expect(type.valid?(double, 'hola')).to eq(false)
      expect(type.valid?(double, 'null')).to eq(false)
      expect(type.valid?(double, 0)).to eq(false)
      expect(type.valid?(double, 1)).to eq(false)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
restspec-0.3.2 spec/restspec/schema/types/null_type_spec.rb
restspec-0.3.1 spec/restspec/schema/types/null_type_spec.rb
restspec-0.3.0 spec/restspec/schema/types/null_type_spec.rb
restspec-0.2.6 spec/restspec/schema/types/null_type_spec.rb
restspec-0.2.5 spec/restspec/schema/types/null_type_spec.rb
restspec-0.2.4 spec/restspec/schema/types/null_type_spec.rb
restspec-0.2.3 spec/restspec/schema/types/null_type_spec.rb
restspec-0.2.2 spec/restspec/schema/types/null_type_spec.rb
restspec-0.2.1 spec/restspec/schema/types/null_type_spec.rb
restspec-0.2 spec/restspec/schema/types/null_type_spec.rb
restspec-0.1 spec/restspec/schema/types/null_type_spec.rb
restspec-0.0.4 spec/restspec/schema/types/null_type_spec.rb
restspec-0.0.3 spec/restspec/schema/types/null_type_spec.rb
restspec-0.0.2 spec/restspec/schema/types/null_type_spec.rb
restspec-0.0.1 spec/restspec/schema/types/null_type_spec.rb