$:.unshift File.dirname(__FILE__) require 'spec_helper' require "echonest" include SpecHelper describe Echonest::Response do before do @success = Echonest::Response.new(< 0 Success 5ZAOMB3BUR8QUN4PE music://id.echonest.com/~/AR/ARH6W4X1187B99274F Radiohead music://id.echonest.com/~/AR/ARH6W4X1187B99274F music://id.echonest.com/5ZAOMB3BUR8QUN4PE/AR/1 0.96974159665 EOM @failure = Echonest::Response.new(< 1 Invalid API key XXXXXX music://id.echonest.com/~/AR/ARH6W4X1187B99274F 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.find('/response/artist/name').first.content.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