Sha256: 68603a4c0fba37f6bf90b63d233206a706fec81a3e80e44b278abaa32a0d4339

Contents?: true

Size: 736 Bytes

Versions: 4

Compression:

Stored size: 736 Bytes

Contents

require 'spec_helper'

module MARC::Spec
  module Queries
    describe CharacterSpec do
      it 'accepts a position' do
        pos = Position.new(3)
        # noinspection RubyArgCount
        v = CharacterSpec.new(pos)
        expect(v.character_spec).to eq(pos)
        expect(v.to_s).to eq('/3')
      end

      it 'accepts a range' do
        range = AlNumRange.new(3, 5)
        # noinspection RubyArgCount
        v = CharacterSpec.new(range)
        expect(v.character_spec).to eq(range)
        expect(v.to_s).to eq('/3-5')
      end

      it 'rejects an invalid characterspec' do
        # noinspection RubyArgCount
        expect { CharacterSpec.new(/([a-z]+)/) }.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/character_spec_spec.rb
ruby-marc-spec-0.1.2 spec/marc/spec/queries/character_spec_spec.rb
ruby-marc-spec-0.1.1 spec/marc/spec/queries/character_spec_spec.rb
ruby-marc-spec-0.1.0 spec/marc/spec/queries/character_spec_spec.rb