Sha256: 307a77d0b9e46d58afb6f9623e49a01e2dda9d585981afddc86f5d21b0069e91

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

require "spec"
require "sevendigital"

describe "FormatDigestor" do

  before do
     @format_digestor = Sevendigital::FormatDigestor.new(nil)
  end

  it "should not digest from invalid xml but throw up (exception)" do

    xml_response = <<XML
<zzz id="17">
	<fileFormat>MP3</fileFormat>
	<bitRate>320</bitRate>
	<drmFree>True</drmFree>
</zzz>
XML

    running {@format_digestor.from_xml(xml_response)}.should raise_error Sevendigital::DigestiveProblem
  end

  it "should parse from xml and populate all properties" do

    xml_response = <<XML
<format id="17">
	<fileFormat>MP3</fileFormat>
	<bitRate>320</bitRate>
	<drmFree>True</drmFree>
</format>
XML

    format = @format_digestor.from_xml(xml_response)
    format.id.should == 17
    format.file_format.should == :MP3
    format.bit_rate.should == 320
    format.drm_free.should == true
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
7digital-0.0.1 spec/digestion_tract/format_digestor_spec.rb