Sha256: 92bce0a9dd55870ad78d5f75710016b42dc8681c652b16d2add4574f12429510

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  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(true) }
  end

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

    it { should be(true) }
  end

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

    it { should be(false) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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