Sha256: 46bb417e305eed7cf1c8ebdf9e464d91f0fa8cb622f8d5b6ff92953c38e51ff3

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'
require 'csv'

module BerkeleyLibrary
  module TIND
    module Mapping

      describe SingleRule do

        attr_reader :single_rule

        before(:each) do
          rows = Util.csv_rows('spec/data/mapping/one_to_one_mapping.csv')
          @single_rule = SingleRule.new(rows[4])
        end

        it 'get origin tag' do
          expect(single_rule.tag_origin).to eq '245'
        end

        it 'get destination tag' do
          expect(single_rule.tag_destination).to eq '245'
        end

        it 'get indicator' do
          expect(single_rule.indicator).to eq [' ', ' ']
        end

        it 'get combined rules' do
          expect(single_rule.combined_rules).to eq [[['n,p', 'p', nil]], [['b,f,k', 'b', nil]]] # combination rules mapped to p and b
        end

        it 'get pre_existed_tag' do
          expect(single_rule.pre_existed_tag).to eq nil
        end

        it 'get pre_existed_tag_subfield ' do
          expect(single_rule.pre_existed_tag_subfield).to eq nil
        end

        it 'get single rule exluding pre_existed_subfield hash' do
          expect(single_rule.single_rule_subfield_excluded_hash).to eq({ '6' => '6', 'a' => 'a' })
        end

        it 'get single rule' do
          expect(single_rule.single_rule_hash).to eq({ '6' => '6', 'a' => 'a' })
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 spec/berkeley_library/tind/mapping/single_rule_spec.rb
berkeley_library-tind-0.7.1 spec/berkeley_library/tind/mapping/single_rule_spec.rb
berkeley_library-tind-0.7.0 spec/berkeley_library/tind/mapping/single_rule_spec.rb
berkeley_library-tind-0.6.0 spec/berkeley_library/tind/mapping/single_rule_spec.rb