Sha256: 88e41137d2cadbd425ed3b8398bbdf2fc5be770e5631c9e26b93360f1dbff88f

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

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

require File.expand_path(File.dirname(__FILE__) + "/my_mapper")

describe "ExampleSpec" do
  describe "mapping spec/fixtures/base.xml" do
    before(:all) do
      @attributes = MyMapper.attributes_from_xml_path(File.expand_path(File.dirname(__FILE__) + '/fixtures/base.xml'))
    end
    
    { 
      :title => "Black on Both Sides", :version_title => "Extended Edition", :released_in => 1999,
      :artist_name => "Mos Def", :artist_id => 1212, :country => "DE", :allows_streaming => true,
      :tracks_count => 2, :released_on => Date.new(1999, 10, 12)
    }.each do |key, value|
      it "extracts #{value.inspect} as #{key}" do
        @attributes[key].should == value
      end
    end
    
    [
      { :track_title => "Fear Not of Man", :track_number => 1, :disk_number => 1, :explicit_lyrics => true },
      { :track_title => "Hip Hop", :track_number => 2, :disk_number => 1, :explicit_lyrics => true },
    ].each_with_index do |hash, offset|
      hash.each do |key, value|
        it "extracts #{value.inspect} for #{key} for track with offset #{offset}" do
          @attributes[:tracks][offset][key].should == value
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xml_mapper-0.3.3 spec/example_spec.rb
xml_mapper-0.3.2 spec/example_spec.rb