Sha256: f4dfffc6fa5e8e16c1a74eed0eb2c9d807f5adfc82d6ad021a17bcf03d6c9b94

Contents?: true

Size: 1.46 KB

Versions: 15

Compression:

Stored size: 1.46 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Axiom::Types::Type, '.new' do
  let(:undefined) { Axiom::Types::Undefined }

  before do
    object.finalize
  end

  context 'with no arguments' do
    subject { object.new }

    let(:object) { described_class }

    it { should be_instance_of(Class) }

    it { should be_frozen }

    its(:ancestors) { should include(object) }

    it 'has no constraints' do
      should include(undefined)
    end
  end

  context 'with a constraint' do
    subject { object.new(proc { false }) }

    let(:object) { described_class }

    it { should be_instance_of(Class) }

    it { should be_frozen }

    its(:ancestors) { should include(object) }

    it 'has constraints' do
      should_not include(undefined)
    end
  end

  context 'with a block' do
    subject do
      object.new do
        constraint { false }
      end
    end

    let(:object) { described_class }

    it { should be_instance_of(Class) }

    it { should be_frozen }

    its(:ancestors) { should include(object) }

    it 'has constraints' do
      should_not include(undefined)
    end
  end

  context 'with a constraint and block' do
    subject do
      object.new(proc { false }) do
        constraint { false }
      end
    end

    let(:object) { described_class }

    it { should be_instance_of(Class) }

    it { should be_frozen }

    its(:ancestors) { should include(object) }

    it 'has constraints' do
      should_not include(undefined)
    end
  end
end

Version data entries

15 entries across 13 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/type/class_methods/new_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/type/class_methods/new_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/type/class_methods/new_spec.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/type/class_methods/new_spec.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/axiom-types-0.1.1/spec/unit/axiom/types/type/class_methods/new_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/type/class_methods/new_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/type/class_methods/new_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/type/class_methods/new_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/type/class_methods/new_spec.rb
axiom-types-0.1.1 spec/unit/axiom/types/type/class_methods/new_spec.rb
axiom-types-0.1.0 spec/unit/axiom/types/type/class_methods/new_spec.rb
axiom-types-0.0.5 spec/unit/axiom/types/type/class_methods/new_spec.rb
axiom-types-0.0.4 spec/unit/axiom/types/type/class_methods/new_spec.rb
axiom-types-0.0.3 spec/unit/axiom/types/type/class_methods/new_spec.rb
axiom-types-0.0.2 spec/unit/axiom/types/type/class_methods/new_spec.rb