Sha256: 17b640d1bbfc5acd00b007c0ebac35ba2c39b82d1dfa42ff8b55a476ac54bed4

Contents?: true

Size: 861 Bytes

Versions: 9

Compression:

Stored size: 861 Bytes

Contents

require File.dirname(__FILE__) + "/../../spec_helper"

describe IMW::Metadata::Field do

  describe "initializing" do
    it "should parse a symbol or string into a hash" do
      IMW::Metadata::Field.new(:foobar).should  == { :name => "foobar" }
      IMW::Metadata::Field.new('foobar').should == { :name => 'foobar' }
    end

    it "should raise an error on a Hash without a :name key" do
      lambda { IMW::Metadata::Field.new(:foo => 'bar') }.should raise_error(IMW::ArgumentError)
    end

    it "should accept a Hash with a :name key" do
      data = { :name => :foobar, :title => "Bazbooz", :unit => "m" }
      IMW::Metadata::Field.new(data).should == data
    end

    it "should dup a field if given one" do
      orig_field = IMW::Metadata::Field.new('foobar')
      IMW::Metadata::Field.new(orig_field).should == orig_field
    end
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
imw-0.2.16 spec/imw/metadata/field_spec.rb
imw-0.2.15 spec/imw/metadata/field_spec.rb
imw-0.2.14 spec/imw/metadata/field_spec.rb
imw-0.2.13 spec/imw/metadata/field_spec.rb
imw-0.2.12 spec/imw/metadata/field_spec.rb
imw-0.2.11 spec/imw/metadata/field_spec.rb
imw-0.2.10 spec/imw/metadata/field_spec.rb
imw-0.2.9 spec/imw/metadata/field_spec.rb
imw-0.2.8 spec/imw/metadata/field_spec.rb