Sha256: c4efbfb9b8484a4c6eaff9502e04051d32e8b483a010356d0261d3b0fb4a7bf7

Contents?: true

Size: 760 Bytes

Versions: 11

Compression:

Stored size: 760 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(:range)      { 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

11 entries across 9 versions & 4 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/length_comparable/finalize_spec.rb
axiom-types-0.1.1 spec/unit/axiom/types/length_comparable/finalize_spec.rb
axiom-types-0.1.0 spec/unit/axiom/types/length_comparable/finalize_spec.rb