Sha256: 2cfa1ab72103801b78774c515c1dfdf11bd3afa639c66706854cf4fc2f683f50

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

require 'hobo/metadata'

describe Hobo::Metadata do
  before do
    Hobo::Metadata.store = {}
    Hobo::Metadata.metadata = {}
    Hobo::Metadata.defaults = {}
  end

  describe "store" do
    it "should expose storage" do
      Hobo::Metadata.store[:opts] = {}
      Hobo::Metadata.store[:opts].should be {}
    end
  end

  describe "metadata" do
    it "should expose metadata" do
      Hobo::Metadata.store[:type] = "value"
      Hobo::Metadata.add "key", :type
      Hobo::Metadata.metadata["key"][:type].should match "value"
    end
  end

  describe "add" do
    it "should assign store value to task metadata for type" do
      Hobo::Metadata.store[:type] = "value"
      Hobo::Metadata.add "key", :type
      Hobo::Metadata.metadata["key"][:type].should match "value"
    end

    it "should set store value to default after add" do
      Hobo::Metadata.default :type, "value"
      Hobo::Metadata.add "key", :type
      Hobo::Metadata.metadata["key"][:type].should match "value"
    end
  end

  describe "default" do
    it "should store default value for type" do
      Hobo::Metadata.default :type, "default"
      Hobo::Metadata.add "key", :type
      Hobo::Metadata.metadata["key"][:type].should match "default"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.4 spec/hobo/metadata_spec.rb
hobo-inviqa-0.0.3 spec/hobo/metadata_spec.rb
hobo-inviqa-0.0.2 spec/hobo/metadata_spec.rb