Sha256: b682a4c099d9c0606d629795897a622c44bce505ce2871a2194f71568b3dcf06

Contents?: true

Size: 950 Bytes

Versions: 2

Compression:

Stored size: 950 Bytes

Contents

require_relative 'spec_helper'

describe Opushon::RestrictedValue do
  subject do
    Opushon::RestrictedValue
  end

  describe 'passes' do
    describe '#to_h' do
      it 'MUST return the hash' do
        subject.new(value: :foobar).to_h.must_equal({
          title:        '',
          description:  '',
          value:        :foobar
        })
      end
    end

    describe '#to_h' do
      it 'MUST return the hash' do
        subject.new(value: :foobar,
                    description: :foobar).to_h.must_equal({
          title:        '',
          description:  'foobar',
          value:        :foobar
        })
      end
    end

    describe '#value' do
      it 'MUST return the value' do
        subject.new(value: :foobar).value.must_equal(:foobar)
      end
    end
  end

  describe 'errors' do
    it 'MUST raise without value' do
      -> { subject.new(description: :foobar) }.must_raise(ArgumentError)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opushon-0.1.1 spec/opushon/restricted_value_spec.rb
opushon-0.1.0 spec/opushon/restricted_value_spec.rb