Sha256: 45eaedff4cadda578516bddb1dfb231d1139999e075eba84f5b733abb06396f1

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Metadata do
  describe ".new" do
    it "should initialize data to an empty hash" do
      Metadata.new.data.should eql({})
    end

    it "should initialize data to the value given in the initializer" do
      Metadata.new(data: { foo: 'bar' }).data.should eql(foo: 'bar')
    end
    
    it "should set empty strings to nil" do
      Metadata.create!(data: { foo: '' }).data.should eql(foo: nil)
    end
    
    it "should not set false values to nil" do
      Metadata.create!(data: { foo: false }).data.should eql(foo: false)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
has_metadata-1.2.2 spec/metadata_spec.rb
has_metadata-1.2.1 spec/metadata_spec.rb