zunnit 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/zunnit/setup.rb +2 -1
- data/lib/zunnit/version.rb +1 -1
- data/spec/zunnit_spec.rb +26 -11
- metadata +2 -2
data/lib/zunnit/setup.rb
CHANGED
@@ -14,7 +14,8 @@ module Zunnit
|
|
14
14
|
:action_items_add => "/action/items/add",
|
15
15
|
:action_items_rate => "/action/items/rate",
|
16
16
|
:action_items_view => "/action/items/view",
|
17
|
-
:action_user_follow => "/action/user/follow"
|
17
|
+
:action_user_follow => "/action/user/follow",
|
18
|
+
:action_feedback_click => "/action/feedback/post"
|
18
19
|
}
|
19
20
|
|
20
21
|
def self.setup
|
data/lib/zunnit/version.rb
CHANGED
data/spec/zunnit_spec.rb
CHANGED
@@ -45,29 +45,29 @@ describe Zunnit do
|
|
45
45
|
|
46
46
|
|
47
47
|
it "should return recommendation groups for user" do
|
48
|
-
pending "404"
|
48
|
+
#pending "404"
|
49
49
|
response = Zunnit.api.get :recommendation_groups_for_user,
|
50
50
|
:user_id => "255"
|
51
51
|
validate_response(response, :groups)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should return recommendation users for user" do
|
55
|
-
pending "404"
|
56
|
-
response = Zunnit.api.get :
|
57
|
-
:user_id => "
|
55
|
+
#pending "404"
|
56
|
+
response = Zunnit.api.get :recommendation_users_for_user,
|
57
|
+
:user_id => "255"
|
58
58
|
validate_response(response, :users)
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should return recommendation users for item" do
|
62
|
-
pending "It should return a collection of users but is returning items"
|
63
|
-
response = Zunnit.api.get :
|
62
|
+
#pending "It should return a collection of users but is returning items"
|
63
|
+
response = Zunnit.api.get :recommendation_users_for_item,
|
64
64
|
:item_id => "20275919",
|
65
65
|
:user_id => "255"
|
66
66
|
validate_response(response, :users)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should return recommendation tags for item" do
|
70
|
-
pending "404"
|
70
|
+
#pending "404"
|
71
71
|
response = Zunnit.api.get :recommendation_tags_for_item,
|
72
72
|
:item_id => "20275919"
|
73
73
|
validate_response(response, :tags)
|
@@ -77,13 +77,13 @@ describe Zunnit do
|
|
77
77
|
pending "404"
|
78
78
|
response = Zunnit.api.get :recommendation_cluster_for_item,
|
79
79
|
:item_id => "20275919"
|
80
|
-
validate_response(response, :
|
80
|
+
validate_response(response, :cluster)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
describe "post" do
|
85
85
|
it "should return status 200 when add an item" do
|
86
|
-
|
86
|
+
intercept_request_to :post,
|
87
87
|
:action => :action_items_add,
|
88
88
|
:params => { :item_id => "2121", :item_text => "text" },
|
89
89
|
:response => { :status => 200, :body => {:msg => 'Ok', :status => 200}.to_json }
|
@@ -92,7 +92,7 @@ describe Zunnit do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
it "should return status 200 when user clip an item" do
|
95
|
-
|
95
|
+
intercept_request_to :post,
|
96
96
|
:action => :action_items_rate,
|
97
97
|
:params => { :item_id => "2121", :user_id => "2121", :rating => 1 },
|
98
98
|
:response => { :status => 200, :body => {:msg => 'Ok', :status => 200}.to_json }
|
@@ -100,6 +100,21 @@ describe Zunnit do
|
|
100
100
|
validate_response Zunnit.api.post :action_items_rate, :item_id => "2121", :user_id => "2121"
|
101
101
|
end
|
102
102
|
|
103
|
+
it "should return status 200 when user view an recommended item" do
|
104
|
+
intercept_request_to :post,
|
105
|
+
:action => :action_feedback_click,
|
106
|
+
:params => {:rec_id => "2121", :rank => 0},
|
107
|
+
:response => {
|
108
|
+
:status => 200,
|
109
|
+
:body => {
|
110
|
+
:msg => "Ok",
|
111
|
+
:status => 200
|
112
|
+
}.to_json
|
113
|
+
}
|
114
|
+
|
115
|
+
validate_response Zunnit.api.post :action_feedback_click, :rec_id => "2121", :rank => 0
|
116
|
+
end
|
117
|
+
|
103
118
|
end
|
104
119
|
|
105
120
|
private
|
@@ -109,7 +124,7 @@ describe Zunnit do
|
|
109
124
|
response[results_key].size.should >= 1 if results_key
|
110
125
|
end
|
111
126
|
|
112
|
-
def
|
127
|
+
def intercept_request_to(method, options)
|
113
128
|
action = options.delete(:action)
|
114
129
|
params = options.delete(:params)
|
115
130
|
response = options.delete(:response)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: zunnit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.3.
|
5
|
+
version: 0.3.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Marcelo Eden
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-09-27 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|