Sha256: 9191d3bd50f037133c9766d27a25d30cc33a118ae790891193b3b7812af4d4d0

Contents?: true

Size: 720 Bytes

Versions: 5

Compression:

Stored size: 720 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Axiom::Types::LengthComparable, '#finalize' do
  subject { object.finalize }

  let(:object) do
    Class.new(Axiom::Types::Type) do
      extend Axiom::Types::LengthComparable
      minimum_length 1
      maximum_length 2
    end
  end

  it_should_behave_like 'a command method'
  it_should_behave_like 'an idempotent method'

  it { should be_frozen }

  its(:constraint) { should be_frozen }

  it 'adds a constraint that returns true for a length within range' do
    should include('a')
    should include('ab')
  end

  it 'adds a constraint that returns false for a length not within range' do
    should_not include('')
    should_not include('abc')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
axiom-types-0.0.5 spec/unit/axiom/types/length_comparable/finalize_spec.rb
axiom-types-0.0.4 spec/unit/axiom/types/length_comparable/finalize_spec.rb
axiom-types-0.0.3 spec/unit/axiom/types/length_comparable/finalize_spec.rb
axiom-types-0.0.2 spec/unit/axiom/types/length_comparable/finalize_spec.rb
axiom-types-0.0.1 spec/unit/axiom/types/length_comparable/finalize_spec.rb