Sha256: f712095bd2652597abe252d7ff814db4293053314b88ae4f8095479d978ba5ea

Contents?: true

Size: 952 Bytes

Versions: 3

Compression:

Stored size: 952 Bytes

Contents

require 'spec_helper'

module BerkeleyLibrary
  module AV
    class Metadata
      describe Value do
        describe :<=> do
          it 'can compare text with links' do
            v1 = Value.new(tag: '956', label: 'test', entries: ['test'], order: 1)
            v2 = Value.new(tag: '956', label: 'test', entries: [Link.new(body: 'test', url: 'http://example.org')], order: 1)
            actual = v1 <=> v2
            expect(actual).not_to eq(0)
            expect(actual).to eq(v1.entries.to_s <=> v2.entries.to_s)
          end

          it 'returns nil for nil' do
            v = Value.new(tag: '956', label: 'test', entries: ['test'], order: 1)
            expect(v <=> nil).to be_nil
          end

          it 'returns nil for things that are not Values' do
            v = Value.new(tag: '956', label: 'test', entries: ['test'], order: 1)
            expect(v <=> v.to_s).to be_nil
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
berkeley_library-av-core-0.4.2 spec/lib/berkeley_library/av/metadata/value_spec.rb
berkeley_library-av-core-0.4.1 spec/lib/berkeley_library/av/metadata/value_spec.rb
berkeley_library-av-core-0.4.0 spec/lib/berkeley_library/av/metadata/value_spec.rb