Sha256: 228f337153e72ed53d3d2c706617e2f0cbdcba2fb4f28d91706c290346cfdb58
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
$:.unshift File.dirname(__FILE__) require 'spec_helper' require "echonest" include SpecHelper describe Echonest::Response do before do @success = Echonest::Response.new(<<EOM) <?xml version="1.0" encoding="UTF-8"?> <response version="3"> <status> <code>0</code> <message>Success</message> </status> <query> <parameter name="api_key">5ZAOMB3BUR8QUN4PE</parameter> <parameter name="id">music://id.echonest.com/~/AR/ARH6W4X1187B99274F</parameter> </query> <artist> <name>Radiohead</name> <id>music://id.echonest.com/~/AR/ARH6W4X1187B99274F</id> <foreign_id>music://id.echonest.com/5ZAOMB3BUR8QUN4PE/AR/1</foreign_id> <familiarity>0.96974159665</familiarity> </artist> </response> EOM @failure = Echonest::Response.new(<<EOM) <?xml version="1.0" encoding="UTF-8"?> <response version="3"> <status> <code>1</code> <message>Invalid API key</message> </status> <query> <parameter name="api_key">XXXXXX</parameter> <parameter name="id">music://id.echonest.com/~/AR/ARH6W4X1187B99274F</parameter> </query> </response> EOM end it "should return status" do @success.status.code.should eql(0) @success.status.message.should eql('Success') @success.success?.should be_true @success.xml.elements['response/artist/name'][0].to_s.should eql('Radiohead') @failure.status.code.should eql(1) @failure.status.message.should eql('Invalid API key') @failure.success?.should be_false end it "should return query" do @success.query[:id].should eql('music://id.echonest.com/~/AR/ARH6W4X1187B99274F') @success.query[:api_key].should eql('5ZAOMB3BUR8QUN4PE') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
youpy-ruby-echonest-0.0.1 | spec/response_spec.rb |
youpy-ruby-echonest-0.0.2 | spec/response_spec.rb |