Sha256: 78c8fced4880e2c95b88e035e86139e435ed6e9a529a43c9dd932513fe1e3589

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:object) { Class.new(Axiom::Types::Collection) }

  context 'with the default member constraints' do
    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 collection' do
      should include([Object.new])
    end

    it 'adds a constraint that returns false for a non-collection' do
      should_not include(Object.new)
    end
  end

  context 'with custom member constraints' do
    let(:member) { :name }

    before do
      object.member_type Axiom::Types::Symbol
    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 valid member' do
      should include([member])
    end

    it 'adds a constraint that returns false for an invalid member' do
      should_not include([member.to_s])
    end
  end
end

Version data entries

14 entries across 12 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/collection/class_methods/finalize_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/collection/class_methods/finalize_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/collection/class_methods/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/collection/class_methods/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/collection/class_methods/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/collection/class_methods/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/collection/class_methods/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/collection/class_methods/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/collection/class_methods/finalize_spec.rb
axiom-types-0.1.1 spec/unit/axiom/types/collection/class_methods/finalize_spec.rb
axiom-types-0.1.0 spec/unit/axiom/types/collection/class_methods/finalize_spec.rb
axiom-types-0.0.5 spec/unit/axiom/types/collection/class_methods/finalize_spec.rb
axiom-types-0.0.4 spec/unit/axiom/types/collection/class_methods/finalize_spec.rb
axiom-types-0.0.3 spec/unit/axiom/types/collection/class_methods/finalize_spec.rb