Sha256: 4569ae64fcd472bab749a4d0ce9321b9218d47f295575536afdaf788716522c3

Contents?: true

Size: 1.57 KB

Versions: 10

Compression:

Stored size: 1.57 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), :contributions => [ 
        { :role => "artist", :name => "Mos Def" },
        { :role => "producer", :name => "DJ Premier" },
      ]
    }.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, :isrc => "1234",
        :version_title => nil
      },
      { 
        :track_title => "Hip Hop", :track_number => 2, :disk_number => 1, :explicit_lyrics => false, :isrc => "2345",
        :version_title => "Album Version", :contributions => {
          :producer => "DJ Premier", :performer => "Mos Def"
        }
      },
    ].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

10 entries across 10 versions & 1 rubygems

Version Path
xml_mapper-0.5.8 spec/example_spec.rb
xml_mapper-0.5.7 spec/example_spec.rb
xml_mapper-0.5.6 spec/example_spec.rb
xml_mapper-0.5.5 spec/example_spec.rb
xml_mapper-0.5.4 spec/example_spec.rb
xml_mapper-0.5.3 spec/example_spec.rb
xml_mapper-0.5.2 spec/example_spec.rb
xml_mapper-0.5.1 spec/example_spec.rb
xml_mapper-0.5.0 spec/example_spec.rb
xml_mapper-0.4.2 spec/example_spec.rb