# encoding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe Zunnit do # let(zunnit) { Zunnit::Api.new } describe "get" do it "should return related items" do zunnit = Zunnit::Api.new response = zunnit.get(:related_items, :item_id => "20275919", :user_id => "255") validate_response(response, :items) end it "should get 400 error if :item_id is not given to related items" do zunnit = Zunnit::Api.new response = zunnit.get(:related_items) response[:status].should == 400 end it "should return recommendation items for user" do zunnit = Zunnit::Api.new response = zunnit.get(:recommendation_items_for_user, :user_id => "255") validate_response(response, :items) end it "should return recommendation groups for user" do pending "404" zunnit = Zunnit::Api.new response = zunnit.get(:recommendation_groups_for_user, :user_id => "255") validate_response(response, :groups) end it "should return recommendation users for user" do pending "404" zunnit = Zunnit::Api.new response = zunnit.get(:recommendation_groups_for_user, :user_id => "2155") validate_response(response, :users) end it "should return recommendation users for item" do pending "It should return a collection of users but is returning items" zunnit = Zunnit::Api.new response = zunnit.get(:recommendation_items_for_user, :item_id => "20275919", :user_id => "255") validate_response(response, :users) end it "should return recommendation tags for item" do pending "404" zunnit = Zunnit::Api.new response = zunnit.get(:recommendation_tags_for_item, :item_id => "20275919") validate_response(response, :tags) end it "should return recommendation cluster for item" do pending "404" zunnit = Zunnit::Api.new response = zunnit.get(:recommendation_cluster_for_item, :item_id => "20275919") validate_response(response, :clusters) end end describe "post" do end private def validate_response(response, results_key) response[:status].should == 200 response[:msg].should == "Ok" response[results_key].size.should >= 1 end end