Sha256: 4e3b56028332f870f130079f7ef24b0f7e61066b5a86aa2dc4cb0a1cd3473181

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

$:.unshift File.dirname(__FILE__)

require 'spec_helper'
require "echonest"

include SpecHelper

describe Echonest::ApiMethods::Catalog do
  before do
    @api = Echonest::Api.new('8TPE3VC60ODJTNTFE')
    @catalog = Echonest::ApiMethods::Catalog.new(@api)
  end

  describe "#create" do
    it "should request to catalog/create with option" do
      catalog_name = "catalog_name"
      catalog_type = "artist"
      @api.should_receive(:request).with("catalog/create", :post, {:name => catalog_name, :type => catalog_type, :format => "json"}).and_return{ Echonest::Response.new('{"hello":"world"}') }
      @catalog.create(catalog_name, catalog_type)
    end
  end

  describe "#update" do
    it "should request to catalog/update with option" do
      catalog_id = "catalog_id"
      data = [{:item=>{:item_id => "hogehoge", :artist_name => "Oscar Peterson"}}]
      @api.should_receive(:request).with("catalog/update", :post, {:id => catalog_id, :data_type => "json", :format => "json", :data => data.to_json}).and_return{ Echonest::Response.new('{"hello":"world"}') }
      @catalog.update(catalog_id, data)
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bassnode-ruby-echonest-0.1.3 spec/catalog_spec.rb