Sha256: 10b56736c4e1852993e2eea0fc3547ce9454dfa415d798e46d029b1326dd1887

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe "MARC4J4R::ControlField basics" do
  it "can create a controlfield via the alias" do
    cf = MARC4J4R::ControlField.new('001')
    cf.tag.should.equal '001'
  end
  
  it "allows get/set of tag and value" do
    cf = MARC4J4R::ControlField.new
    cf.tag = '001'
    cf.value = 'Value'
    cf.tag.should.equal '001'
    cf.value.should.equal 'Value'
  end
  
  it "can create a cf with both arguments" do
    cf = MARC4J4R::ControlField.new('001', 'Test')
    cf.value.should.equal 'Test'
    cf.tag.should.equal '001'
  end
  
  it "can identify good/bad tags" do
    MARC4J4R::ControlField.control_tag?('000').should.equal true  
    MARC4J4R::ControlField.control_tag?('001').should.equal true  
    MARC4J4R::ControlField.control_tag?('009').should.equal true  
    MARC4J4R::ControlField.control_tag?('010').should.equal false
    MARC4J4R::ControlField.control_tag?('011').should.equal false
  end
  
  it "provides a working ==" do
    cf = MARC4J4R::ControlField.new('001', 'Test')
    clone = MARC4J4R::ControlField.new('001', 'Test')
    mutant = MARC4J4R::ControlField.new('001', 'DDDDD')
    cf.should.equal clone
    clone.should.equal cf
    cf.should.not.equal mutant
    mutant.should.not.equal clone
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marc4j4r-0.9.0 spec/controlfield_spec.rb
marc4j4r-0.2.4 spec/controlfield_spec.rb
marc4j4r-0.2.2 spec/controlfield_spec.rb