Permalink
Browse files

Fixed issue with site_id being specified for an account with only one…

… site failed
  • Loading branch information...
Jordan Dobson
Jordan Dobson committed Jun 11, 2009
1 parent a0a458e commit ed665dc36187239e7c419e03b242b608baf976c2
Showing with 18 additions and 6 deletions.
  1. +6 −0 History.txt
  2. +3 −2 Rakefile
  3. +3 −3 lib/posterous.rb
  4. +1 −1 posterous.gemspec
  5. +5 −0 test/test_posterous.rb
View
@@ -1,3 +1,9 @@
+=== 0.1.6 / 2009-06-11
+
+* 1 fix
+
+ * Fixed issue where specifying site ID while only having one site cause has_site? to fail
+
=== 0.1.5 / 2009-06-03
* 1 major enhancement
View
@@ -6,7 +6,8 @@ require './lib/posterous.rb'
Hoe.new('posterous', Posterous::VERSION) do |p|
p.developer('Jordan Dobson', 'jordan.dobson@madebysquad.com')
- p.extra_deps = ['httparty', 'mocha']
+ p.extra_deps = ['httparty']
+ p.extra_dev_deps = ['mocha']
end
-# vim: syntax=Ruby
+# vim: syntax=Ruby
View
@@ -3,7 +3,7 @@
module Posterous
- VERSION = '0.1.5'
+ VERSION = '0.1.6'
class AuthError < StandardError; end
class TagError < StandardError; end
@@ -23,7 +23,7 @@ class Client
POST_PATH = '/api/newpost'
AUTH_PATH = '/api/getsites'
- include HTTParty
+ include HTTParty
base_uri DOMAIN
attr_accessor :title, :body, :source, :source_url, :date
@@ -59,7 +59,7 @@ def has_site?
case res["site"]
when Hash
return true unless @site_id
- @site_id && @site_id == res["site"]["id"]
+ return @site_id == res["site"]["id"]
when Array
res["site"].each do |site|
return true if @site_id && @site_id == site["id"]
View
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = %q{posterous}
- s.version = "0.1.5"
+ s.version = "0.1.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jordan Dobson"]
View
@@ -179,6 +179,11 @@ def test_has_site_fails_if_site_id_doesnt_match_only_result
Posterous::Client.stubs(:post).returns(@resp_ok)
assert_equal false, @new_obj_with_bad_id.has_site?
end
+
+ def test_has_site_successful_that_site_id_matches_response
+ Posterous::Client.stubs(:post).returns(@resp_ok)
+ assert_equal true, @new_obj_with_id.has_site?
+ end
def test_has_site_is_successful_on_multiple_when_specified
Posterous::Client.stubs(:post).returns(@resp_ok_2_sites)

0 comments on commit ed665dc

Please sign in to comment.