Sha256: 7a69b3a1f0293b1bcd82835714fbf2f663b37de487096f72abfeef47adbaad1a

Contents?: true

Size: 1.31 KB

Versions: 6

Compression:

Stored size: 1.31 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'
    cf.controlField?.should.equal true
  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'
    cf.to_s.should.equal '001    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

6 entries across 6 versions & 1 rubygems

Version Path
marc4j4r-1.4.1 spec/controlfield_spec.rb
marc4j4r-1.4.0 spec/controlfield_spec.rb
marc4j4r-1.3.0 spec/controlfield_spec.rb
marc4j4r-1.2.0 spec/controlfield_spec.rb
marc4j4r-1.1.0 spec/controlfield_spec.rb
marc4j4r-1.0.0 spec/controlfield_spec.rb