Sha256: 7f45acba37f2f17d55ad91d92a321912b1b920b8c682fa4c8f47b49b770a2635

Contents?: true

Size: 730 Bytes

Versions: 4

Compression:

Stored size: 730 Bytes

Contents

require 'spec_helper'

module MARC::Spec
  module Queries
    describe IndicatorValue do
      it 'accepts an int indicator' do
        v = IndicatorValue.new(1)
        expect(v.ind).to eq(1)
        expect(v.to_s).to eq('^1')
      end

      it 'accepts a string indicator' do
        v = IndicatorValue.new('1')
        expect(v.ind).to eq(1)
        expect(v.to_s).to eq('^1')
      end

      it 'rejects a nil indicator' do
        expect { IndicatorValue.new(nil) }.to raise_error(ArgumentError)
      end

      it 'rejects an invalid indicator' do
        expect { IndicatorValue.new(3) }.to raise_error(ArgumentError)
        expect { IndicatorValue.new('3') }.to raise_error(ArgumentError)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-marc-spec-0.1.3 spec/marc/spec/queries/indicator_value_spec.rb
ruby-marc-spec-0.1.2 spec/marc/spec/queries/indicator_value_spec.rb
ruby-marc-spec-0.1.1 spec/marc/spec/queries/indicator_value_spec.rb
ruby-marc-spec-0.1.0 spec/marc/spec/queries/indicator_value_spec.rb