tipjoy 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.9
1
+ 0.0.10
@@ -39,7 +39,7 @@ module Tipjoy
39
39
 
40
40
  def notify_tipjoy
41
41
  json = tipjoy_request(:post,"http://tipjoy.com/api/tweetpayment/notify/", { "tweet_id" => self.tweet_id })
42
- Transaction.new(json)
42
+ Transaction.new(json['transactions'][0])
43
43
  end
44
44
  end
45
45
  end
@@ -61,14 +61,35 @@ describe Tipjoy::Payment do
61
61
  describe "#pay" do
62
62
  before do
63
63
  @payment_tweet = {"user"=>
64
- {"name"=>"poopr",
65
- "id"=>42670876,
66
- "screen_name"=>"poopr111"
67
- },
68
- "text"=>"p $1.25 @poopr112 for api test",
69
- "id"=>1939894288,
70
- "created_at"=>"Wed May 27 21:30:34 +0000 2009"
64
+ {"name"=>"poopr",
65
+ "id"=>42670876,
66
+ "screen_name"=>"poopr111"
67
+ },
68
+ "text"=>"p $1.25 @poopr112 for api test",
69
+ "id"=>1939894288,
70
+ "created_at"=>"Wed May 27 21:30:34 +0000 2009"
71
71
  }
72
+ @expected_transaction = {"result"=>"success",
73
+ "transactions"=>[
74
+ {"permalink"=>"http://twitter.com/poopr112",
75
+ "time"=>"2009-05-27 15:53:21",
76
+ "twitter_username"=>"poopr111",
77
+ "is_private"=>false,
78
+ "twitter_user_id"=>"42670876",
79
+ "username"=>"poopr111",
80
+ "transaction_id"=>47702,
81
+ "amount"=>"1.25",
82
+ "userid"=>56673,
83
+ "tweet_message"=>"p $1.25 @poopr112 for api test",
84
+ "prettyTime"=>"4 days ago", "date_joined"=>"2009-05-26 10:24:07",
85
+ "verified"=>false,
86
+ "isLoan"=>1,
87
+ "tweet_id"=>"1939894288",
88
+ "tweet_message_html"=>"p $1.25 <a href='http://twitter.com/poopr112'>@poopr112</a> for api test",
89
+ "profile_image_url"=>"http://s3.amazonaws.com/twitter_thumbs/default.jpg"
90
+ }],
91
+ "request"=>"/api/tweetpayment/notify/"
92
+ }
72
93
  end
73
94
 
74
95
 
@@ -83,18 +104,6 @@ describe Tipjoy::Payment do
83
104
  @payment.pay
84
105
  end
85
106
 
86
- #todo remove mock
87
- it "should construct a transaction" do
88
- @payment.transaction_id.should be_nil
89
- @client.should_receive(:update).with("p $1.25 @poopr112 for api test").and_return(@payment_tweet)
90
- @payment.should_receive(:tipjoy_request).and_return({:transaction_id => 1})
91
-
92
- transaction = @payment.pay
93
-
94
- transaction.should_not be_nil
95
- transaction.transaction_id.should == 1
96
- end
97
-
98
107
  it "should construct a transaction" do
99
108
  @payment.transaction_id.should be_nil
100
109
  @client.should_receive(:update).with("p $1.25 @poopr112 for api test").and_return(@payment_tweet)
@@ -102,7 +111,7 @@ describe Tipjoy::Payment do
102
111
  transaction = @payment.pay
103
112
 
104
113
  transaction.should_not be_nil
105
- transaction.transaction_id.should == 1
114
+ transaction.transaction_id.should == @expected_transaction['transactions'][0]['transaction_id']
106
115
  end
107
116
 
108
117
  describe "failure" do
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  dir = File.expand_path(File.dirname(__FILE__))
2
2
  require "rubygems"
3
3
  require 'spec'
4
- #require 'spec/autorun'
4
+ require 'spec/autorun'
5
5
  #require 'mash'
6
6
  require dir + '/../init'
7
7
  require dir + '/doubles/fake_oauth_client'
@@ -31,4 +31,6 @@ share_examples_for "tipjoy request maker that might fail" do
31
31
  @request.call
32
32
  }.should raise_error(Tipjoy::RequestError)
33
33
  end
34
- end
34
+ end
35
+
36
+ Tipjoy.log!
data/tipjoy.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tipjoy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Thompson
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-05-30 00:00:00 -07:00
14
+ date: 2009-06-01 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tipjoy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Thompson
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-05-30 00:00:00 -07:00
14
+ date: 2009-06-01 00:00:00 -07:00
15
15
  default_executable:
16
16
  dependencies: []
17
17