purevolume 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2009-06-16
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,7 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/purevolume
6
+ lib/purevolume.rb
7
+ test/test_purevolume.rb
@@ -0,0 +1,95 @@
1
+ = purevolume
2
+
3
+ * http://github.com/jordandobson/Purevolume/tree/master
4
+
5
+ == DESCRIPTION:
6
+
7
+ The Purevolume gem enables posting to Purevolume.com using your email/login-name, password and your blog title & body content. You can also access some basic info about a users account.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Title & Body text is required
12
+ * Provides info about an account:
13
+ * Profile Name
14
+ * Profile URL
15
+ * Account Type (artist/listener)
16
+ * Blog URL
17
+ * Can Check if login info is a valid user
18
+ * This Gem is throughly tested
19
+ * Image files are not yet implemented
20
+ * Listeners posts are defaulted to General Category
21
+ * Posting Only, Editing, Deleting & Reading in posts are included
22
+
23
+ == SYNOPSIS:
24
+
25
+ 1. Instantiate your account
26
+
27
+ * Provide the email and password
28
+
29
+ account = Purevolume::Client.new( 'hello@gluenow.com', 'password' )
30
+
31
+ * Or Provide login-name and password
32
+
33
+ account = Purevolume::Client.new( 'glue', 'password' )
34
+
35
+ 2. Get more info about the user's account & check if they are a valid user
36
+
37
+ * Check if the user is valid
38
+
39
+ account.valid_user?
40
+
41
+ * Get some info about this account - and recieve a hash or nil back
42
+
43
+ response = account.account_info
44
+
45
+ response #=> {"rsp"=>{"site"=>{"name"=>"Glue Artist", "profile"=>"http://www.purevolume.com/GlueArtist", "type"=>:artist, "blog"=>"http://www.purevolume.com/GlueArtist/posts"}, "stat"=>"ok"}}
46
+
47
+ 3. Post your Content
48
+
49
+ * Both Title and Body are required - Set to a variable to check the response
50
+
51
+ response = account.post("My Title", "My Body")
52
+
53
+ 4. Get a success or error hash back
54
+
55
+ * A Successful response would look like this
56
+
57
+ response #=> {"rsp"=>{"post"=>{"title"=>"My Title", "url"=>"http://www.purevolume.com/GlueArtist/posts/228991", "id"=>"228991"}, "stat"=>"ok"}}
58
+
59
+ * A Error response would look like this
60
+
61
+ response #=> {"rsp"=>{"err"=>{"msg"=>"Post was unsuccessful.", "title"=>"My Title"}, "stat"=>"fail"}}
62
+
63
+
64
+ == REQUIREMENTS:
65
+
66
+ * Mechanize & Mocha (for tests)
67
+
68
+ == INSTALL:
69
+
70
+ * sudo gem install posterous -include-dependencies
71
+
72
+ == LICENSE:
73
+
74
+ (The MIT License)
75
+
76
+ Copyright (c) 2009 Jordan Dobson
77
+
78
+ Permission is hereby granted, free of charge, to any person obtaining
79
+ a copy of this software and associated documentation files (the
80
+ 'Software'), to deal in the Software without restriction, including
81
+ without limitation the rights to use, copy, modify, merge, publish,
82
+ distribute, sublicense, and/or sell copies of the Software, and to
83
+ permit persons to whom the Software is furnished to do so, subject to
84
+ the following conditions:
85
+
86
+ The above copyright notice and this permission notice shall be
87
+ included in all copies or substantial portions of the Software.
88
+
89
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
90
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
92
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
93
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
94
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
95
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/purevolume.rb'
6
+
7
+ Hoe.new('purevolume', Purevolume::VERSION) do |p|
8
+ p.developer('Jordan Dobson', 'jordan.dobson@madebysquad.com')
9
+ p.extra_deps = ['mechanize']
10
+ p.extra_dev_deps = ['mocha']
11
+ end
12
+
13
+ # vim: syntax=Ruby
@@ -0,0 +1 @@
1
+ #!/usr/bin/env ruby
@@ -0,0 +1,119 @@
1
+ require 'rubygems'
2
+ require 'mechanize'
3
+
4
+ module Purevolume
5
+ VERSION = '0.1.1'
6
+
7
+ class Client
8
+ SITE = 'http://www.purevolume.com'
9
+ LOGIN = '/login'
10
+ POSTS = '/dashboard?s=posts&tab='
11
+ ADD = 'add_post'
12
+ LIST = 'posts'
13
+ GENERAL = 'General'
14
+ SUCCESS = 'div.success_message'
15
+ DASHBOARD = '/dashboard'
16
+
17
+ def initialize username, password
18
+ @agent = WWW::Mechanize.new
19
+ @username = username
20
+ @password = password
21
+ @login_pg = @add_post_pg = @dashboard = @profile_url = @blog_url = @type = @valid = nil
22
+ end
23
+
24
+ def valid_user?
25
+ @valid || authenticate
26
+ end
27
+
28
+ def authenticate
29
+ @login_pg || login_page
30
+ login_form = @login_pg.forms_with( :action => LOGIN ).first
31
+
32
+ if login_form
33
+ login_form.username = @username
34
+ login_form.password = @password
35
+ response_page = @agent.submit( login_form )
36
+ @dashboard = response_page if response_page.uri.to_s == "#{SITE}#{DASHBOARD}"
37
+ end
38
+ @valid = can_post?
39
+ end
40
+
41
+ def post title, body
42
+ @add_post_pg || add_post_page
43
+ post_form = @add_post_pg.forms_with( :action => "#{POSTS}#{ADD}" ).first
44
+
45
+ if post_form
46
+ category = post_form.field_with( :name => 'category' )
47
+ category.options.each { |opt| opt.select if opt.value == GENERAL } if category
48
+ post_form.blog_title = title
49
+ post_form.blog_post = body
50
+ response = !@agent.submit( post_form, post_form.buttons.first ).search( SUCCESS ).empty?
51
+ end
52
+ response ? success_response(title) : error_response(title)
53
+ end
54
+
55
+ def account_info
56
+ { "rsp" => { "site" => {
57
+ "name" => profile_name,
58
+ "profile" => profile_url,
59
+ "type" => profile_type,
60
+ "blog" => profile_blog_url },
61
+ "stat" => "ok" }
62
+ } if @valid
63
+ end
64
+
65
+ private
66
+ def add_post_page; @add_post_pg = @agent.get( "#{SITE}#{POSTS}#{ADD}" ); end
67
+ def login_page; @login_pg = @agent.get( "#{SITE}#{LOGIN}" ); end
68
+
69
+ def success_response title
70
+ pid = latest_post_id
71
+ url = "#{profile_blog_url}/#{pid}"
72
+ { "rsp" => { "post" => {
73
+ "title" => title,
74
+ "url" => url,
75
+ "id" => pid },
76
+ "stat" => "ok" }
77
+ }
78
+ end
79
+
80
+ def error_response title
81
+ { "rsp" => { "err" => {
82
+ "msg" => "Post was unsuccessful.",
83
+ "title" => "#{title}" },
84
+ "stat" => "fail" }
85
+ }
86
+ end
87
+
88
+ def latest_post_id
89
+ @agent.get( "#{SITE}#{POSTS}#{POSTS}" ).at("#posts table tr td strong a")['href'].sub(/.+id=/, '')
90
+ end
91
+
92
+ def profile_name
93
+ @dashboard.at( "a[href='#{DASHBOARD}'] span" ).content.sub( "Logged in as ", "" ) rescue nil
94
+ end
95
+
96
+ def profile_url
97
+ @dashboard.search(".dashboard_link_dropdown_item a").each do |link|
98
+ return @profile_url = "#{SITE}#{link['href']}" if link.content == "Profile"
99
+ end
100
+ end
101
+
102
+ def profile_type
103
+ @profile_url || profile_url
104
+ @type = @profile_url =~ /http:\/\/.*\/(\w*)\// ? $1.sub("listeners", "listener").to_sym : :artist
105
+ end
106
+
107
+ def profile_blog_url
108
+ @profile_url || profile_url
109
+ @type || profile_type
110
+ @blog_url = @profile_url + (@type == :listener ? "/blog" : "/posts")
111
+ end
112
+
113
+ def can_post?
114
+ @add_post_pg || add_post_page
115
+ !@add_post_pg.search( "form[action='#{POSTS}#{ADD}']" ).empty?
116
+ end
117
+
118
+ end
119
+ end
@@ -0,0 +1,389 @@
1
+ require "test/unit"
2
+ require "purevolume"
3
+ require "mocha"
4
+
5
+ class Purevolume::Client
6
+ attr_accessor :add_post_pg, :valid, :dashboard, :agent
7
+ public :can_post?, :profile_url, :profile_name, :profile_type, \
8
+ :profile_blog_url, :latest_post_id, :success_response, :error_response
9
+ end
10
+
11
+ class TestPurevolume < Test::Unit::TestCase
12
+
13
+ # IN FUTURE VERSIONS
14
+ # Specify a category in listener posts
15
+ # Post an image in artist posts
16
+ # Add Post to billboard or promo Area
17
+ # Reading in Posts
18
+
19
+ def setup
20
+ artist = 'artist'
21
+ listener = 'listener'
22
+ password = 'password'
23
+
24
+ @artist_good = Purevolume::Client.new( artist, password )
25
+ @listener_good = Purevolume::Client.new( listener, password )
26
+ @artist_bad = Purevolume::Client.new( artist, 'bad' )
27
+
28
+ @title = "My Title"
29
+ @body = "Body Text"
30
+ @post_id = "228991"
31
+
32
+ @listener_name = "Glue Listener"
33
+ @listener_type = :listener
34
+ @listener_url = "http://www.purevolume.com/listeners/GlueListener"
35
+ @listener_blog = "http://www.purevolume.com/listeners/GlueListener/blog"
36
+
37
+ @artist_name = "Glue Artist"
38
+ @artist_type = :artist
39
+ @artist_url = "http://www.purevolume.com/GlueArtist"
40
+ @artist_blog = "http://www.purevolume.com/GlueArtist/posts"
41
+
42
+ @error_response = { "rsp" => { "err" => {
43
+ "msg" => "Post was unsuccessful.",
44
+ "title" => @title },
45
+ "stat" => "fail" }}
46
+
47
+ @error_response2= { "rsp" => { "err" => {
48
+ "msg" => "Post was unsuccessful.",
49
+ "title" => "" },
50
+ "stat" => "fail" }}
51
+
52
+ empty_page = "<html><body></body></html>"
53
+ post_page = "<html><body><form action='#{Purevolume::Client::POSTS}#{Purevolume::Client::ADD}'><select name='category'><option value='#{Purevolume::Client::GENERAL}'>General</option><option value='invalid'>Invalid</option></select><input name='blog_title' /><input name='blog_post' /></form></body></html>"
54
+ dashboard_artist_page = "<html><body><a href='/dashboard'><span>Logged in as Glue Artist</span></a><div class='dashboard_link_dropdown_item'><a href='/GlueArtist'>Profile</a></div></body></html>"
55
+ dashboard_listener_page = "<html><body><a href='/dashboard'><span>Logged in as Glue Listener</span></a><div class='dashboard_link_dropdown_item'><a href='/listeners/GlueListener'>Profile</a></div></body></html>"
56
+ post_list_page = "<html><body><div id='posts'><table><tr><td><strong><a href='dashboard?s=posts&tab=posts&action=edit&id=#{@post_id}'>#{@title}</strong></td></tr></table></body></html>"
57
+ success_page = "<html><body><div class='success_message'></div></body></html>"
58
+
59
+ @bad_page = setup_mock_mechanize empty_page
60
+ @post_page = setup_mock_mechanize post_page
61
+ @artist_dashboard = setup_mock_mechanize dashboard_artist_page
62
+ @listener_dashboard = setup_mock_mechanize dashboard_listener_page
63
+ @list_page = setup_mock_mechanize post_list_page
64
+ @success_page = setup_mock_mechanize success_page
65
+ end
66
+
67
+ def setup_mock_mechanize page
68
+ WWW::Mechanize::Page.new(nil, {'content-type' => 'text/html'}, page, 200)
69
+ end
70
+
71
+ def test_can_not_post
72
+ account = @artist_bad
73
+ account.stubs(:authenticate ).returns( false )
74
+ account.stubs(:add_post_page).returns( account.add_post_pg = @bad_page )
75
+ assert_equal false, account.can_post?
76
+ end
77
+
78
+ def test_can_post
79
+ account = @artist_good
80
+ account.stubs(:authenticate ).returns( true )
81
+ account.stubs(:add_post_page).returns( account.add_post_pg = @post_page )
82
+ assert_equal true, account.can_post?
83
+ end
84
+
85
+ def test_artist_account_valid
86
+ account = @artist_good
87
+ account.stubs(:authenticate ).returns( account.valid = true )
88
+ assert_equal true, account.valid_user?
89
+ end
90
+
91
+ def test_listener_account_valid
92
+ account = @listener_good
93
+ account.stubs(:authenticate ).returns( account.valid = true )
94
+ assert_equal true, account.valid_user?
95
+ end
96
+
97
+ def test_account_invalid
98
+ account = @artist_bad
99
+ account.stubs(:authenticate ).returns( account.valid = false )
100
+ assert_equal false, account.valid_user?
101
+ end
102
+
103
+ def test_artist_account_url
104
+ account = @artist_good
105
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
106
+ account.authenticate
107
+ assert_equal @artist_url, account.profile_url
108
+ end
109
+
110
+ def test_listener_account_url
111
+ account = @listener_good
112
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
113
+ account.authenticate
114
+ assert_equal @listener_url, account.profile_url
115
+ end
116
+
117
+ def test_bad_account_url
118
+ account = @artist_bad
119
+ account.stubs(:authenticate ).returns( account.valid = false )
120
+ assert_raise NoMethodError do
121
+ account.profile_url
122
+ end
123
+ end
124
+
125
+ def test_artist_account_name
126
+ account = @artist_good
127
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
128
+ account.authenticate
129
+ assert_equal @artist_name, account.profile_name
130
+ end
131
+
132
+ def test_listener_account_name
133
+ account = @listener_good
134
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
135
+ account.authenticate
136
+ assert_equal @listener_name, account.profile_name
137
+ end
138
+
139
+ def test_bad_account_name
140
+ account = @artist_bad
141
+ account.stubs(:authenticate ).returns( false )
142
+ account.authenticate
143
+ assert_equal nil, account.profile_name
144
+ end
145
+
146
+ def test_listener_account_type
147
+ account = @listener_good
148
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
149
+ account.authenticate
150
+ assert_equal @listener_type, account.profile_type
151
+ end
152
+
153
+ def test_artist_account_type
154
+ account = @artist_good
155
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
156
+ account.authenticate
157
+ assert_equal @artist_type, account.profile_type
158
+ end
159
+
160
+ def test_bad_account_type
161
+ account = @artist_bad
162
+ account.stubs(:authenticate ).returns( false )
163
+ account.authenticate
164
+ assert_raise NoMethodError do
165
+ account.profile_type
166
+ end
167
+ end
168
+
169
+ def test_listener_blog_url
170
+ account = @listener_good
171
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
172
+ account.authenticate
173
+ assert_equal @listener_blog, account.profile_blog_url
174
+ end
175
+
176
+ def test_artist_blog_url
177
+ account = @artist_good
178
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
179
+ account.authenticate
180
+ assert_equal @artist_blog, account.profile_blog_url
181
+ end
182
+
183
+ def test_bad_blog_url
184
+ account = @artist_bad
185
+ account.stubs(:authenticate ).returns( false )
186
+ account.authenticate
187
+ assert_raise NoMethodError do
188
+ account.profile_blog_url
189
+ end
190
+ end
191
+
192
+ def test_artist_account_info
193
+ account = @artist_good
194
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
195
+ account.stubs(:authenticate ).returns( account.valid = true )
196
+ account.authenticate
197
+ expected = { "rsp" => { "site" => {
198
+ "name" => @artist_name,
199
+ "profile" => @artist_url,
200
+ "type" => @artist_type,
201
+ "blog" => @artist_blog },
202
+ "stat" => "ok" }}
203
+ assert_equal expected, account.account_info
204
+ end
205
+
206
+ def test_listener_account_info
207
+ account = @listener_good
208
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
209
+ account.stubs(:authenticate ).returns( account.valid = true )
210
+ account.authenticate
211
+ expected = { "rsp" => { "site" => {
212
+ "name" => @listener_name,
213
+ "profile" => @listener_url,
214
+ "type" => @listener_type,
215
+ "blog" => @listener_blog },
216
+ "stat" => "ok" }}
217
+ assert_equal expected, account.account_info
218
+ end
219
+
220
+ def test_bad_artist_account_info
221
+ account = @artist_bad
222
+ account.stubs(:authenticate ).returns( false )
223
+ account.authenticate
224
+ assert_equal nil, account.account_info
225
+ end
226
+
227
+ def test_artist_latest_post_id
228
+ account = @artist_good
229
+ account.agent.stubs(:get).returns( @list_page )
230
+ account.stubs(:authenticate ).returns( account.valid = true )
231
+ account.authenticate
232
+ assert_equal @post_id, account.latest_post_id
233
+ end
234
+
235
+ def test_listener_latest_post_id
236
+ account = @listener_good
237
+ account.agent.stubs(:get).returns( @list_page )
238
+ account.stubs(:authenticate ).returns( account.valid = true )
239
+ account.authenticate
240
+ assert_equal @post_id, account.latest_post_id
241
+ end
242
+
243
+ def test_bad_account_latest_post_id
244
+ account = @artist_bad
245
+ account.agent.stubs(:get).returns( @bad_page )
246
+ account.stubs(:authenticate ).returns( false )
247
+ account.authenticate
248
+ assert_raise NoMethodError do
249
+ account.latest_post_id
250
+ end
251
+ end
252
+
253
+ def test_artist_response_success
254
+ account = @artist_good
255
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
256
+ account.stubs(:authenticate ).returns( account.valid = true )
257
+ account.agent.stubs( :get ).returns( @list_page )
258
+ pid = account.latest_post_id
259
+ url = "#{@artist_blog}/#{pid}"
260
+ expected = { "rsp" => { "post" => {
261
+ "title" => "#{@title}",
262
+ "url" => "#{url}",
263
+ "id" => "#{pid}"},
264
+ "stat" => "ok" }}
265
+
266
+ assert_equal expected, account.success_response( @title )
267
+ end
268
+
269
+ def test_listener_response_success
270
+ account = @listener_good
271
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
272
+ account.stubs(:authenticate ).returns( account.valid = true )
273
+ account.agent.stubs( :get ).returns( @list_page )
274
+ pid = account.latest_post_id
275
+ url = "#{@listener_blog}/#{pid}"
276
+ expected = { "rsp" => { "post" => {
277
+ "title" => "#{@title}",
278
+ "url" => "#{url}",
279
+ "id" => "#{pid}"},
280
+ "stat" => "ok" }}
281
+
282
+ assert_equal expected, @listener_good.success_response( @title )
283
+ end
284
+
285
+ def test_account_response_error
286
+ expected = @error_response
287
+
288
+ assert_equal expected, @artist_good.error_response( @title )
289
+ assert_equal expected, @artist_bad.error_response( @title )
290
+ assert_equal expected, @listener_good.error_response( @title )
291
+ end
292
+
293
+ def test_bad_account_response_success
294
+ account = @artist_bad
295
+ account.stubs(:authenticate ).returns( account.valid = false )
296
+ account.agent.stubs( :get ).returns( @bad_page )
297
+ assert_raise NoMethodError do
298
+ account.success_response(@title)
299
+ end
300
+ end
301
+
302
+ def test_post_success_artist
303
+ account = @artist_good
304
+
305
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
306
+ account.stubs(:authenticate ).returns( account.valid = true )
307
+ account.stubs(:add_post_page).returns( account.add_post_pg = @post_page )
308
+ account.agent.stubs(:submit ).returns( @success_page )
309
+ account.agent.stubs( :get ).returns( @list_page )
310
+
311
+ actual = account.post( @title, @body )
312
+ pid = actual['rsp']['post']['id']
313
+ blog = @artist_blog
314
+
315
+ assert pid
316
+ assert actual.is_a?(Hash)
317
+ assert_match pid, actual['rsp']['post']['url']
318
+ assert_match blog, actual['rsp']['post']['url']
319
+ assert_equal "#{blog}/#{pid}", actual['rsp']['post']['url']
320
+ assert_equal @title, actual['rsp']['post']['title']
321
+ assert_equal "ok", actual['rsp']['stat']
322
+ end
323
+
324
+ def test_post_success_listener
325
+ account = @listener_good
326
+
327
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
328
+ account.stubs(:authenticate ).returns( account.valid = true )
329
+ account.stubs(:add_post_page).returns( account.add_post_pg = @post_page )
330
+ account.agent.stubs(:submit ).returns( @success_page )
331
+ account.agent.stubs( :get ).returns( @list_page )
332
+
333
+ actual = account.post( @title, @body )
334
+ pid = actual['rsp']['post']['id']
335
+ blog = @listener_blog
336
+
337
+ assert pid
338
+ assert actual.is_a?(Hash)
339
+ assert_match pid, actual['rsp']['post']['url']
340
+ assert_match blog, actual['rsp']['post']['url']
341
+ assert_equal "#{blog}/#{pid}", actual['rsp']['post']['url']
342
+ assert_equal @title, actual['rsp']['post']['title']
343
+ assert_equal "ok", actual['rsp']['stat']
344
+ end
345
+
346
+ def test_post_fail_bad_account
347
+ account = @artist_bad
348
+ account.stubs(:authenticate ).returns( account.valid = false )
349
+ account.stubs(:add_post_page).returns( account.add_post_pg = @bad_page )
350
+ assert_equal @error_response, account.post( @title, @body )
351
+ end
352
+
353
+ def test_artist_post_fail_with_blank_title
354
+ account = @artist_good
355
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
356
+ account.stubs(:authenticate ).returns( account.valid = true )
357
+ account.stubs(:add_post_page).returns( account.add_post_pg = @post_page )
358
+ account.agent.stubs(:submit ).returns( @bad_page )
359
+ assert_equal @error_response2, account.post( "", @body )
360
+ end
361
+
362
+ def test_listener_post_fail_with_blank_title
363
+ account = @listener_good
364
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
365
+ account.stubs(:authenticate ).returns( account.valid = true )
366
+ account.stubs(:add_post_page).returns( account.add_post_pg = @post_page )
367
+ account.agent.stubs(:submit ).returns( @bad_page )
368
+ assert_equal @error_response2, account.post( "", @body )
369
+ end
370
+
371
+ def test_artist_post_fail_with_blank_body
372
+ account = @artist_good
373
+ account.stubs(:authenticate ).returns( account.dashboard = @artist_dashboard )
374
+ account.stubs(:authenticate ).returns( account.valid = true )
375
+ account.stubs(:add_post_page).returns( account.add_post_pg = @post_page )
376
+ account.agent.stubs(:submit ).returns( @bad_page )
377
+ assert_equal @error_response, account.post( @title, "" )
378
+ end
379
+
380
+ def test_listener_post_fail_with_blank_body
381
+ account = @listener_good
382
+ account.stubs(:authenticate ).returns( account.dashboard = @listener_dashboard )
383
+ account.stubs(:authenticate ).returns( account.valid = true )
384
+ account.stubs(:add_post_page).returns( account.add_post_pg = @post_page )
385
+ account.agent.stubs(:submit ).returns( @bad_page )
386
+ assert_equal @error_response, account.post( @title, "" )
387
+ end
388
+
389
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: purevolume
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Jordan Dobson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mechanize
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: mocha
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.12.2
44
+ version:
45
+ description: The Purevolume gem enables posting to Purevolume.com using your email/login-name, password and your blog title & body content. You can also access some basic info about a users account.
46
+ email:
47
+ - jordan.dobson@madebysquad.com
48
+ executables:
49
+ - purevolume
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - History.txt
54
+ - Manifest.txt
55
+ - README.txt
56
+ files:
57
+ - History.txt
58
+ - Manifest.txt
59
+ - README.txt
60
+ - Rakefile
61
+ - bin/purevolume
62
+ - lib/purevolume.rb
63
+ - test/test_purevolume.rb
64
+ has_rdoc: true
65
+ homepage: http://github.com/jordandobson/Purevolume/tree/master
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options:
70
+ - --main
71
+ - README.txt
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ version:
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ version:
86
+ requirements: []
87
+
88
+ rubyforge_project: purevolume
89
+ rubygems_version: 1.3.3
90
+ signing_key:
91
+ specification_version: 3
92
+ summary: The Purevolume gem enables posting to Purevolume.com using your email/login-name, password and your blog title & body content
93
+ test_files:
94
+ - test/test_purevolume.rb