trakt_api 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module TraktApi
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -5,12 +5,6 @@ describe TraktApi::Activity do
5
5
  let(:mock_model) { SampleModel.new }
6
6
 
7
7
  describe '.community' do
8
- it 'should call optional_auth' do
9
- model.should_receive(:optional_auth).and_return(mock_model)
10
-
11
- model.community
12
- end
13
-
14
8
  it 'should call get with specific params' do
15
9
  model.instance_variable_set("@method", :get)
16
10
  model.should_receive(:get).with('activity/community').and_return(mock_model)
@@ -18,26 +12,20 @@ describe TraktApi::Activity do
18
12
  model.community
19
13
  end
20
14
 
21
- it 'should call restful_params' do
22
- model.should_receive(:restful_params).and_return(mock_model)
15
+ it 'should call params' do
16
+ model.should_receive(:params).and_return(mock_model)
23
17
 
24
18
  model.community
25
19
  end
26
20
 
27
- it 'should call params' do
28
- model.should_receive(:params).and_return(mock_model)
21
+ it 'should call restful_params' do
22
+ model.should_receive(:restful_params).and_return(mock_model)
29
23
 
30
24
  model.community
31
25
  end
32
26
  end
33
27
 
34
28
  describe '.episodes' do
35
- it 'should call optional_auth' do
36
- model.should_receive(:optional_auth).and_return(mock_model)
37
-
38
- model.episodes(title: 'test', season: 1, episode: 2)
39
- end
40
-
41
29
  it 'should call get with specific params' do
42
30
  model.instance_variable_set("@method", :get)
43
31
  model.should_receive(:get).with('activity/episodes').and_return(mock_model)
@@ -45,14 +33,14 @@ describe TraktApi::Activity do
45
33
  model.episodes(title: 'test', season: 1, episode: 2)
46
34
  end
47
35
 
48
- it 'should call restful_params' do
49
- model.should_receive(:restful_params).and_return(mock_model)
36
+ it 'should call params' do
37
+ model.should_receive(:params).and_return(mock_model)
50
38
 
51
39
  model.episodes(title: 'test', season: 1, episode: 2)
52
40
  end
53
41
 
54
- it 'should call params' do
55
- model.should_receive(:params).and_return(mock_model)
42
+ it 'should call restful_params' do
43
+ model.should_receive(:restful_params).and_return(mock_model)
56
44
 
57
45
  model.episodes(title: 'test', season: 1, episode: 2)
58
46
  end
@@ -77,15 +65,15 @@ describe TraktApi::Activity do
77
65
 
78
66
  model.friends
79
67
  end
80
- end
81
68
 
82
- describe '.movies' do
83
- it 'should call optional_auth' do
84
- model.should_receive(:optional_auth).and_return(mock_model)
69
+ it 'should call restful_params' do
70
+ model.should_receive(:restful_params).and_return(mock_model)
85
71
 
86
- model.movies(title: 'test')
72
+ model.friends
87
73
  end
74
+ end
88
75
 
76
+ describe '.movies' do
89
77
  it 'should call get with specific params' do
90
78
  model.instance_variable_set("@method", :get)
91
79
  model.should_receive(:get).with('activity/movies').and_return(mock_model)
@@ -93,26 +81,20 @@ describe TraktApi::Activity do
93
81
  model.movies(title: 'test')
94
82
  end
95
83
 
96
- it 'should call restful_params' do
97
- model.should_receive(:restful_params).and_return(mock_model)
84
+ it 'should call params' do
85
+ model.should_receive(:params).and_return(mock_model)
98
86
 
99
87
  model.movies(title: 'test')
100
88
  end
101
89
 
102
- it 'should call params' do
103
- model.should_receive(:params).and_return(mock_model)
90
+ it 'should call restful_params' do
91
+ model.should_receive(:restful_params).and_return(mock_model)
104
92
 
105
93
  model.movies(title: 'test')
106
94
  end
107
95
  end
108
96
 
109
97
  describe '.seasons' do
110
- it 'should call optional_auth' do
111
- model.should_receive(:optional_auth).and_return(mock_model)
112
-
113
- model.seasons(title: 'test', season: 1)
114
- end
115
-
116
98
  it 'should call get with specific params' do
117
99
  model.instance_variable_set("@method", :get)
118
100
  model.should_receive(:get).with('activity/seasons').and_return(mock_model)
@@ -120,26 +102,20 @@ describe TraktApi::Activity do
120
102
  model.seasons(title: 'test', season: 1)
121
103
  end
122
104
 
123
- it 'should call restful_params' do
124
- model.should_receive(:restful_params).and_return(mock_model)
105
+ it 'should call params' do
106
+ model.should_receive(:params).and_return(mock_model)
125
107
 
126
108
  model.seasons(title: 'test', season: 1)
127
109
  end
128
110
 
129
- it 'should call params' do
130
- model.should_receive(:params).and_return(mock_model)
111
+ it 'should call restful_params' do
112
+ model.should_receive(:restful_params).and_return(mock_model)
131
113
 
132
114
  model.seasons(title: 'test', season: 1)
133
115
  end
134
116
  end
135
117
 
136
118
  describe '.shows' do
137
- it 'should call optional_auth' do
138
- model.should_receive(:optional_auth).and_return(mock_model)
139
-
140
- model.shows(title: 'test')
141
- end
142
-
143
119
  it 'should call get with specific params' do
144
120
  model.instance_variable_set("@method", :get)
145
121
  model.should_receive(:get).with('activity/shows').and_return(mock_model)
@@ -147,26 +123,20 @@ describe TraktApi::Activity do
147
123
  model.shows(title: 'test')
148
124
  end
149
125
 
150
- it 'should call restful_params' do
151
- model.should_receive(:restful_params).and_return(mock_model)
126
+ it 'should call params' do
127
+ model.should_receive(:params).and_return(mock_model)
152
128
 
153
129
  model.shows(title: 'test')
154
130
  end
155
131
 
156
- it 'should call params' do
157
- model.should_receive(:params).and_return(mock_model)
132
+ it 'should call restful_params' do
133
+ model.should_receive(:restful_params).and_return(mock_model)
158
134
 
159
135
  model.shows(title: 'test')
160
136
  end
161
137
  end
162
138
 
163
139
  describe '.user' do
164
- it 'should call optional_auth' do
165
- model.should_receive(:optional_auth).and_return(mock_model)
166
-
167
- model.user(username: 'test')
168
- end
169
-
170
140
  it 'should call get with specific params' do
171
141
  model.instance_variable_set("@method", :get)
172
142
  model.should_receive(:get).with('activity/user').and_return(mock_model)
@@ -174,26 +144,20 @@ describe TraktApi::Activity do
174
144
  model.user(username: 'test')
175
145
  end
176
146
 
177
- it 'should call restful_params' do
178
- model.should_receive(:restful_params).and_return(mock_model)
147
+ it 'should call params' do
148
+ model.should_receive(:params).and_return(mock_model)
179
149
 
180
150
  model.user(username: 'test')
181
151
  end
182
152
 
183
- it 'should call params' do
184
- model.should_receive(:params).and_return(mock_model)
153
+ it 'should call restful_params' do
154
+ model.should_receive(:restful_params).and_return(mock_model)
185
155
 
186
156
  model.user(username: 'test')
187
157
  end
188
158
  end
189
159
 
190
160
  describe '.user_episodes' do
191
- it 'should call optional_auth' do
192
- model.should_receive(:optional_auth).and_return(mock_model)
193
-
194
- model.user_episodes(username: 'justin', title: 'test', season: 1, episode: 2)
195
- end
196
-
197
161
  it 'should call get with specific params' do
198
162
  model.instance_variable_set("@method", :get)
199
163
  model.should_receive(:get).with('activity/user/episodes').and_return(mock_model)
@@ -201,26 +165,20 @@ describe TraktApi::Activity do
201
165
  model.user_episodes(username: 'justin', title: 'test', season: 1, episode: 2)
202
166
  end
203
167
 
204
- it 'should call restful_params' do
205
- model.should_receive(:restful_params).and_return(mock_model)
168
+ it 'should call params' do
169
+ model.should_receive(:params).and_return(mock_model)
206
170
 
207
171
  model.user_episodes(username: 'justin', title: 'test', season: 1, episode: 2)
208
172
  end
209
173
 
210
- it 'should call params' do
211
- model.should_receive(:params).and_return(mock_model)
174
+ it 'should call restful_params' do
175
+ model.should_receive(:restful_params).and_return(mock_model)
212
176
 
213
177
  model.user_episodes(username: 'justin', title: 'test', season: 1, episode: 2)
214
178
  end
215
179
  end
216
180
 
217
181
  describe '.user_movies' do
218
- it 'should call optional_auth' do
219
- model.should_receive(:optional_auth).and_return(mock_model)
220
-
221
- model.user_movies(username: 'justin', title: 'test')
222
- end
223
-
224
182
  it 'should call get with specific params' do
225
183
  model.instance_variable_set("@method", :get)
226
184
  model.should_receive(:get).with('activity/user/movies').and_return(mock_model)
@@ -228,26 +186,20 @@ describe TraktApi::Activity do
228
186
  model.user_movies(username: 'justin', title: 'test')
229
187
  end
230
188
 
231
- it 'should call restful_params' do
232
- model.should_receive(:restful_params).and_return(mock_model)
189
+ it 'should call params' do
190
+ model.should_receive(:params).and_return(mock_model)
233
191
 
234
192
  model.user_movies(username: 'justin', title: 'test')
235
193
  end
236
194
 
237
- it 'should call params' do
238
- model.should_receive(:params).and_return(mock_model)
195
+ it 'should call restful_params' do
196
+ model.should_receive(:restful_params).and_return(mock_model)
239
197
 
240
198
  model.user_movies(username: 'justin', title: 'test')
241
199
  end
242
200
  end
243
201
 
244
202
  describe '.user_seasons' do
245
- it 'should call optional_auth' do
246
- model.should_receive(:optional_auth).and_return(mock_model)
247
-
248
- model.user_seasons(username: 'justin', title: 'test', season: 1)
249
- end
250
-
251
203
  it 'should call get with specific params' do
252
204
  model.instance_variable_set("@method", :get)
253
205
  model.should_receive(:get).with('activity/user/seasons').and_return(mock_model)
@@ -255,26 +207,20 @@ describe TraktApi::Activity do
255
207
  model.user_seasons(username: 'justin', title: 'test', season: 1)
256
208
  end
257
209
 
258
- it 'should call restful_params' do
259
- model.should_receive(:restful_params).and_return(mock_model)
210
+ it 'should call params' do
211
+ model.should_receive(:params).and_return(mock_model)
260
212
 
261
213
  model.user_seasons(username: 'justin', title: 'test', season: 1)
262
214
  end
263
215
 
264
- it 'should call params' do
265
- model.should_receive(:params).and_return(mock_model)
216
+ it 'should call restful_params' do
217
+ model.should_receive(:restful_params).and_return(mock_model)
266
218
 
267
219
  model.user_seasons(username: 'justin', title: 'test', season: 1)
268
220
  end
269
221
  end
270
222
 
271
223
  describe '.user_shows' do
272
- it 'should call optional_auth' do
273
- model.should_receive(:optional_auth).and_return(mock_model)
274
-
275
- model.user_shows(username: 'justin', title: 'test')
276
- end
277
-
278
224
  it 'should call get with specific params' do
279
225
  model.instance_variable_set("@method", :get)
280
226
  model.should_receive(:get).with('activity/user/shows').and_return(mock_model)
@@ -282,14 +228,14 @@ describe TraktApi::Activity do
282
228
  model.user_shows(username: 'justin', title: 'test')
283
229
  end
284
230
 
285
- it 'should call restful_params' do
286
- model.should_receive(:restful_params).and_return(mock_model)
231
+ it 'should call params' do
232
+ model.should_receive(:params).and_return(mock_model)
287
233
 
288
234
  model.user_shows(username: 'justin', title: 'test')
289
235
  end
290
236
 
291
- it 'should call params' do
292
- model.should_receive(:params).and_return(mock_model)
237
+ it 'should call restful_params' do
238
+ model.should_receive(:restful_params).and_return(mock_model)
293
239
 
294
240
  model.user_shows(username: 'justin', title: 'test')
295
241
  end
@@ -15,14 +15,6 @@ describe TraktApi::Base do
15
15
  end
16
16
  end
17
17
 
18
- describe '.optionl_auth' do
19
- it 'should call auth' do
20
- model.should_receive(:auth)
21
-
22
- model.optional_auth(auth: true)
23
- end
24
- end
25
-
26
18
  describe '.store_uri' do
27
19
  it 'should set uri' do
28
20
  model.stub(:api_key).and_return('API_KEY')
@@ -70,7 +62,7 @@ describe TraktApi::Base do
70
62
 
71
63
  describe '.params' do
72
64
  it 'should set @params' do
73
- model.params(sample: true)
65
+ model.params(sample: true, auth: true)
74
66
 
75
67
  model.instance_variable_get('@params').should == { sample: true }
76
68
  end
@@ -79,10 +71,11 @@ describe TraktApi::Base do
79
71
  describe '.restful_params' do
80
72
  it 'should return correct uri' do
81
73
  model.instance_variable_set('@uri', 'URI')
74
+ model.instance_variable_set('@params', { sample: 'test' })
82
75
 
83
- model.restful_params({}, [])
76
+ model.restful_params([:sample])
84
77
 
85
- model.instance_variable_get('@uri').should == 'URI/'
78
+ model.instance_variable_get('@uri').should == 'URI/test'
86
79
  end
87
80
  end
88
81
 
@@ -5,15 +5,15 @@ describe TraktApi::Calendar do
5
5
  let(:mock_model) { SampleModel.new }
6
6
 
7
7
  describe '.settings' do
8
- it 'should call optional_auth' do
9
- model.should_receive(:optional_auth).and_return(mock_model)
8
+ it 'should call get with specific params' do
9
+ model.instance_variable_set("@method", :get)
10
+ model.should_receive(:get).with('calendar/premieres').and_return(mock_model)
10
11
 
11
12
  model.premieres(date: '20130101')
12
13
  end
13
14
 
14
- it 'should call get with specific params' do
15
- model.instance_variable_set("@method", :get)
16
- model.should_receive(:get).with('calendar/premieres').and_return(mock_model)
15
+ it 'should call params' do
16
+ model.should_receive(:params).and_return(mock_model)
17
17
 
18
18
  model.premieres(date: '20130101')
19
19
  end
@@ -26,15 +26,15 @@ describe TraktApi::Calendar do
26
26
  end
27
27
 
28
28
  describe '.shows' do
29
- it 'should call optional_auth' do
30
- model.should_receive(:optional_auth).and_return(mock_model)
29
+ it 'should call get with specific params' do
30
+ model.instance_variable_set("@method", :get)
31
+ model.should_receive(:get).with('calendar/shows').and_return(mock_model)
31
32
 
32
33
  model.shows(date: '20130101')
33
34
  end
34
35
 
35
- it 'should call get with specific params' do
36
- model.instance_variable_set("@method", :get)
37
- model.should_receive(:get).with('calendar/shows').and_return(mock_model)
36
+ it 'should call params' do
37
+ model.should_receive(:params).and_return(mock_model)
38
38
 
39
39
  model.shows(date: '20130101')
40
40
  end
@@ -42,7 +42,7 @@ describe TraktApi::Calendar do
42
42
  it 'should call restful_params' do
43
43
  model.should_receive(:restful_params).and_return(mock_model)
44
44
 
45
- model.shows(date: '20130101')
45
+ model.premieres(date: '20130101')
46
46
  end
47
47
  end
48
48
  end
@@ -4,18 +4,18 @@ describe TraktApi::Movie do
4
4
  let(:model) { TraktApi::Movie.new(TraktApi::Client.new) }
5
5
  let(:mock_model) { SampleModel.new }
6
6
 
7
- describe '.cancel_checkin' do
7
+ describe '.cancel_check_in' do
8
8
  it 'should call auth' do
9
9
  model.should_receive(:auth).and_return(mock_model)
10
10
 
11
- model.cancel_checkin
11
+ model.cancel_check_in
12
12
  end
13
13
 
14
14
  it 'should call post with specific params' do
15
15
  model.instance_variable_set("@method", :post)
16
16
  model.should_receive(:post).with('movie/cancelcheckin').and_return(mock_model)
17
17
 
18
- model.cancel_checkin
18
+ model.cancel_check_in
19
19
  end
20
20
  end
21
21
 
@@ -34,24 +34,24 @@ describe TraktApi::Movie do
34
34
  end
35
35
  end
36
36
 
37
- describe '.checkin' do
37
+ describe '.check_in' do
38
38
  it 'should call auth' do
39
39
  model.should_receive(:auth).and_return(mock_model)
40
40
 
41
- model.checkin(sample: true)
41
+ model.check_in(sample: true)
42
42
  end
43
43
 
44
44
  it 'should call post with specific params' do
45
45
  model.instance_variable_set("@method", :post)
46
46
  model.should_receive(:post).with('movie/checkin').and_return(mock_model)
47
47
 
48
- model.checkin(sample: true)
48
+ model.check_in(sample: true)
49
49
  end
50
50
 
51
51
  it 'should call params' do
52
52
  model.should_receive(:params).and_return(mock_model)
53
53
 
54
- model.checkin(sample: true)
54
+ model.check_in(sample: true)
55
55
  end
56
56
  end
57
57
 
@@ -134,15 +134,15 @@ describe TraktApi::Movie do
134
134
  end
135
135
 
136
136
  describe '.related' do
137
- it 'should call optional_auth' do
138
- model.should_receive(:optional_auth).and_return(mock_model)
137
+ it 'should call get with specific params' do
138
+ model.instance_variable_set("@method", :get)
139
+ model.should_receive(:get).with('movie/related').and_return(mock_model)
139
140
 
140
141
  model.related(title: 'TITLE', hidewatched: 'HIDEWATCH')
141
142
  end
142
143
 
143
- it 'should call get with specific params' do
144
- model.instance_variable_set("@method", :get)
145
- model.should_receive(:get).with('movie/related').and_return(mock_model)
144
+ it 'should call params' do
145
+ model.should_receive(:params).and_return(mock_model)
146
146
 
147
147
  model.related(title: 'TITLE', hidewatched: 'HIDEWATCH')
148
148
  end
@@ -162,6 +162,12 @@ describe TraktApi::Movie do
162
162
  model.stats(title: 'TITLE')
163
163
  end
164
164
 
165
+ it 'should call params' do
166
+ model.should_receive(:params).and_return(mock_model)
167
+
168
+ model.stats(title: 'TITLE')
169
+ end
170
+
165
171
  it 'should call restful_params' do
166
172
  model.should_receive(:restful_params).and_return(mock_model)
167
173
 
@@ -170,15 +176,15 @@ describe TraktApi::Movie do
170
176
  end
171
177
 
172
178
  describe '.summary' do
173
- it 'should call optional_auth' do
174
- model.should_receive(:optional_auth).and_return(mock_model)
179
+ it 'should call get with specific params' do
180
+ model.instance_variable_set("@method", :get)
181
+ model.should_receive(:get).with('movie/summary').and_return(mock_model)
175
182
 
176
183
  model.summary(title: 'TITLE')
177
184
  end
178
185
 
179
- it 'should call get with specific params' do
180
- model.instance_variable_set("@method", :get)
181
- model.should_receive(:get).with('movie/summary').and_return(mock_model)
186
+ it 'should call params' do
187
+ model.should_receive(:params).and_return(mock_model)
182
188
 
183
189
  model.summary(title: 'TITLE')
184
190
  end
@@ -198,6 +204,12 @@ describe TraktApi::Movie do
198
204
  model.summaries(title: 'TITLE', extended: 'EXTENDED')
199
205
  end
200
206
 
207
+ it 'should call params' do
208
+ model.should_receive(:params).and_return(mock_model)
209
+
210
+ model.summaries(title: 'TITLE', extended: 'EXTENDED')
211
+ end
212
+
201
213
  it 'should call restful_params' do
202
214
  model.should_receive(:restful_params).and_return(mock_model)
203
215
 
@@ -290,15 +302,15 @@ describe TraktApi::Movie do
290
302
  end
291
303
 
292
304
  describe '.watching_now' do
293
- it 'should call optional_auth' do
294
- model.should_receive(:optional_auth).and_return(mock_model)
305
+ it 'should call get with specific params' do
306
+ model.instance_variable_set("@method", :get)
307
+ model.should_receive(:get).with('movie/watchingnow').and_return(mock_model)
295
308
 
296
309
  model.watching_now(title: 'TITLE')
297
310
  end
298
311
 
299
- it 'should call get with specific params' do
300
- model.instance_variable_set("@method", :get)
301
- model.should_receive(:get).with('movie/watchingnow').and_return(mock_model)
312
+ it 'should call params' do
313
+ model.should_receive(:params).and_return(mock_model)
302
314
 
303
315
  model.watching_now(title: 'TITLE')
304
316
  end