Sha256: 0520ebc0d2236582900e7c1139c04e2246778423e3d89e65f58834350e612217

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Attribute, '#optional?' do
  subject { object.optional? }

  let(:described_class) { Class.new(Attribute) }

  before do
    described_class.stub(type: Types::Object)
  end

  context 'without :required option passed to constructor' do
    let(:object) { described_class.new(:name) }

    it { should be(false) }
  end

  context 'with required: true option passed to constructor' do
    let(:object) { described_class.new(:name, required: true) }

    it { should be(false) }
  end

  context 'with required: false option passed to constructor' do
    let(:object) { described_class.new(:name, required: false) }

    it { should be(true) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.1 spec/unit/axiom/attribute/optional_predicate_spec.rb