Sha256: 27c627acffc6082c60624c15b4129b42df62515141b3b9ca193752be61ace0e9

Contents?: true

Size: 803 Bytes

Versions: 9

Compression:

Stored size: 803 Bytes

Contents

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

describe IMW::Metadata::Schema do

  describe "initializing" do
    it "should accept an array" do
      IMW::Metadata::Schema.new([1,2,3]).should == [{:name => '1'}, {:name => '2'}, {:name => '3'}]
    end

    it "should dup a Schema if given one" do
      orig_schema = IMW::Metadata::Schema.new([1,2,3])
      IMW::Metadata::Schema.new(orig_schema).should == orig_schema
    end
  end

  describe 'loading' do
    it "should load an Array in a resource" do
      resource = IMW.open('some_resource')
      resource.should_receive(:load).and_return(%w[foo bar baz])
      IMW.should_receive(:open).and_return(resource)
      IMW::Metadata::Schema.load(resource.to_s).map { |field| field[:name] }.should == %w[foo bar baz]
    end

  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

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