gratitude 0.0.10 → 0.0.11

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,74 @@
1
+ {
2
+ "http_interactions": [
3
+ {
4
+ "request": {
5
+ "method": "post",
6
+ "uri": "https://5962b93a-5bf7-4cb6-ae6f-aa4114c5e4f2:@www.gittip.com/gratitude_test/tips.json",
7
+ "body": {
8
+ "encoding": "UTF-8",
9
+ "string": "[{\"amount\":\"1.00\",\"platform\":\"gittip\",\"username\":\"whit537\"},{\"amount\":\"0.25\",\"platform\":\"gittip\",\"username\":\"JohnKellyFerguson\"},{\"amount\":\"1.00\",\"platform\":\"gittip\",\"username\":\"Gittip\"}]"
10
+ },
11
+ "headers": {
12
+ "User-Agent": [
13
+ "Faraday v0.8.9"
14
+ ],
15
+ "Accept-Encoding": [
16
+ "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
17
+ ],
18
+ "Accept": [
19
+ "*/*"
20
+ ]
21
+ }
22
+ },
23
+ "response": {
24
+ "status": {
25
+ "code": 200,
26
+ "message": "OK"
27
+ },
28
+ "headers": {
29
+ "Content-Language": [
30
+ "en"
31
+ ],
32
+ "Content-Type": [
33
+ "application/json"
34
+ ],
35
+ "Date": [
36
+ "Sun, 30 Mar 2014 02:04:01 GMT"
37
+ ],
38
+ "Expires": [
39
+ "Thu, 01 Jan 1970 00:00:00 GMT"
40
+ ],
41
+ "Server": [
42
+ "Aspen! Cheroot!"
43
+ ],
44
+ "Set-Cookie": [
45
+ "csrf_token=N8bOZ2pxIKJWwxwyRTtTjUTB7emonNEN; expires=Sun, 29 Mar 2015 02:04:01 GMT; Path=/",
46
+ "session=None; expires=Sun, 06 Apr 2014 02:04:01 GMT; httponly; Path=/; secure"
47
+ ],
48
+ "Vary": [
49
+ "Cookie"
50
+ ],
51
+ "X-Frame-Options": [
52
+ "SAMEORIGIN"
53
+ ],
54
+ "X-Gittip-Version": [
55
+ "12.2.2"
56
+ ],
57
+ "Content-Length": [
58
+ "308"
59
+ ],
60
+ "Connection": [
61
+ "keep-alive"
62
+ ]
63
+ },
64
+ "body": {
65
+ "encoding": "UTF-8",
66
+ "string": "[\n {\n \"amount\": \"1.00\",\n \"platform\": \"gittip\",\n \"username\": \"whit537\"\n },\n {\n \"amount\": \"0.25\",\n \"platform\": \"gittip\",\n \"username\": \"JohnKellyFerguson\"\n },\n {\n \"amount\": \"1.00\",\n \"platform\": \"gittip\",\n \"username\": \"Gittip\"\n }\n]"
67
+ },
68
+ "http_version": null
69
+ },
70
+ "recorded_at": "Sun, 30 Mar 2014 02:04:00 GMT"
71
+ }
72
+ ],
73
+ "recorded_with": "VCR 2.9.0"
74
+ }
@@ -3,8 +3,8 @@ require "spec_helper"
3
3
  describe Gratitude::Client do
4
4
 
5
5
  describe "default attributes" do
6
- it "includes httparty methods" do
7
- expect(Gratitude::Client).to include(HTTParty)
6
+ it "includes Gratitude::Connection" do
7
+ expect(Gratitude::Client).to include(Gratitude::Connection)
8
8
  end
9
9
 
10
10
  it "includes tips methods" do
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ class TestObject
4
+ include Gratitude::Connection
5
+ end
6
+
7
+ describe TestObject do
8
+ let(:test_object) { TestObject.new }
9
+
10
+ describe "#faraday" do
11
+ it "is an instance of Faraday::Connection" do
12
+ expect(test_object.faraday.class).to eq(Faraday::Connection)
13
+ end
14
+
15
+ it "sets the correct gittip base url" do
16
+ expect(test_object.faraday.url_prefix.to_s)
17
+ .to eq("https://www.gittip.com/")
18
+ end
19
+ end
20
+ end
@@ -1,15 +1,12 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Gratitude::Payday do
4
+ before { VCR.insert_cassette "paydays" }
5
+ after { VCR.eject_cassette }
4
6
 
5
7
  describe "default attributes" do
6
- it "includes httparty methods" do
7
- expect(Gratitude::Payday).to include(HTTParty)
8
- end
9
-
10
- it "has the base uri set to gittip's payday api endpoint" do
11
- expect(Gratitude::Payday.base_uri)
12
- .to eq("https://www.gittip.com/about/paydays.json")
8
+ it "extends Gratitude::Connection" do
9
+ expect(Gratitude::Payday.is_a?(Gratitude::Connection)).to eq(true)
13
10
  end
14
11
 
15
12
  it "initially sets the PAYDAYS constant to an empty array" do
@@ -18,27 +15,6 @@ describe Gratitude::Payday do
18
15
  end
19
16
 
20
17
  describe "class methods" do
21
- before { VCR.insert_cassette "paydays" }
22
- after { VCR.eject_cassette }
23
-
24
- describe "#get_paydays_from_gittip" do
25
- it "returns an array" do
26
- expect(Gratitude::Payday.get_paydays_from_gittip.class).to be(Array)
27
- end
28
-
29
- it "returns the correct number of items in the array" do
30
- expect(Gratitude::Payday.get_paydays_from_gittip.size).to eq(68)
31
- end
32
- end
33
-
34
- describe "#collect_paydays" do
35
- it "creates all payday objects and stores them in the PAYDAYS constant" do
36
- expect {
37
- Gratitude::Payday.collect_paydays
38
- }.to change { Gratitude::Payday::PAYDAYS.size }.from(0).to(68)
39
- end
40
- end
41
-
42
18
  describe "#all" do
43
19
  before { Gratitude::Payday::PAYDAYS = [] }
44
20
 
@@ -47,33 +23,35 @@ describe Gratitude::Payday do
47
23
  end
48
24
 
49
25
  it "updates the PAYDAYS constant when it is empty" do
50
- expect(Gratitude::Payday.all.size).to eq(68)
26
+ expect { Gratitude::Payday.all }
27
+ .to change { Gratitude::Payday::PAYDAYS.size }.from(0)
51
28
  end
52
29
 
53
30
  it "its array should be comprised of Payday objects" do
54
- expect(Gratitude::Payday.all.first.class).to be(Gratitude::Payday)
31
+ Gratitude::Payday.all.each do |payday|
32
+ expect(payday.class).to eq(Gratitude::Payday)
33
+ end
55
34
  end
56
35
  end
57
36
 
58
37
  describe "#sort_by_ts_end" do
59
- it "places the newest payday first" do
60
- expect(Gratitude::Payday.sort_by_ts_end.first.ts_end.year).to eq(2013)
61
- expect(Gratitude::Payday.sort_by_ts_end.first.ts_end.month).to eq(9)
62
- expect(Gratitude::Payday.sort_by_ts_end.first.ts_end.day).to eq(12)
63
- end
64
-
65
- it "places the oldest item last" do
66
- expect(Gratitude::Payday.sort_by_ts_end.last.ts_end.year).to eq(2012)
67
- expect(Gratitude::Payday.sort_by_ts_end.last.ts_end.month).to eq(6)
68
- expect(Gratitude::Payday.sort_by_ts_end.last.ts_end.day).to eq(1)
38
+ it "places the newest payday before the oldest payday" do
39
+ expect(Gratitude::Payday.sort_by_ts_end.first.ts_end)
40
+ .to be > (Gratitude::Payday.sort_by_ts_end.last.ts_end)
69
41
  end
70
42
  end
71
43
 
72
44
  describe "#most_recent" do
73
45
  it "returns the most recent payday" do
74
- expect(Gratitude::Payday.most_recent.ts_end.year).to eq(2013)
75
- expect(Gratitude::Payday.most_recent.ts_end.month).to eq(9)
76
- expect(Gratitude::Payday.most_recent.ts_end.day).to eq(12)
46
+ expect(Gratitude::Payday.most_recent)
47
+ .to eq(Gratitude::Payday.sort_by_ts_end.first)
48
+ end
49
+ end
50
+
51
+ describe "#oldest_payday" do
52
+ it "returns the oldest payday" do
53
+ expect(Gratitude::Payday.oldest_payday)
54
+ .to eq(Gratitude::Payday.sort_by_ts_end.last)
77
55
  end
78
56
  end
79
57
 
@@ -89,24 +67,23 @@ describe Gratitude::Payday do
89
67
  }.to change{ Gratitude::Payday::PAYDAYS.size }.by(1)
90
68
  end
91
69
 
92
- let(:payday) { Gratitude::Payday.new( {
93
- 'ach_fees_volume' => 0,
94
- 'ach_volume' => -2246.96,
95
- 'charge_fees_volume' => 216.09,
96
- 'charge_volume' => 4583.22,
97
- 'nachs' => 53,
98
- 'nactive' => 1719,
99
- 'ncc_failing' => 178,
100
- 'ncc_missing' => 1222,
101
- 'ncharges' => 276,
102
- 'nparticipants' => 19567,
103
- 'ntippers' => 1105,
104
- 'ntransfers' => 3309,
105
- 'transfer_volume' => 5464.38,
106
- 'ts_end' => "2013-09-12T14:01:41.848587+00:00",
107
- 'ts_start' => "2013-09-12T12:36:52.967371+00:00"
108
- } )
109
- }
70
+ let(:payday) { Gratitude::Payday.oldest_payday }
71
+ # Actual Oldest Payday response
72
+ # ach_fees_volume: 0,
73
+ # ach_volume: 0,
74
+ # charge_fees_volume: 0.34,
75
+ # charge_volume: 3.3,
76
+ # nachs: 0,
77
+ # nactive: 4,
78
+ # ncc_failing: 0,
79
+ # ncc_missing: 0,
80
+ # ncharges: 2,
81
+ # nparticipants: 2,
82
+ # ntippers: 2,
83
+ # ntransfers: 4,
84
+ # transfer_volume: 2.96,
85
+ # ts_end: "2012-06-01T07:16:31.080825+00:00",
86
+ # ts_start: "2012-06-01T07:01:13.376763+00:00"
110
87
 
111
88
  describe "#ach_fees_volume" do
112
89
  it "returns the correct ach fees volume" do
@@ -116,25 +93,25 @@ describe Gratitude::Payday do
116
93
 
117
94
  describe "#ach_volume" do
118
95
  it "returns the correct ach volume" do
119
- expect(payday.ach_volume).to eq(-2246.96)
96
+ expect(payday.ach_volume).to eq(0)
120
97
  end
121
98
  end
122
99
 
123
100
  describe "#charge_fees_volume" do
124
101
  it "returns the correct charge fees volume" do
125
- expect(payday.charge_fees_volume).to eq(216.09)
102
+ expect(payday.charge_fees_volume).to eq(0.34)
126
103
  end
127
104
  end
128
105
 
129
106
  describe "#charge_volume" do
130
107
  it "returns the correct charge volume" do
131
- expect(payday.charge_volume).to eq(4583.22)
108
+ expect(payday.charge_volume).to eq(3.3)
132
109
  end
133
110
  end
134
111
 
135
112
  describe "#number_of_ach_credits" do
136
113
  it "returns the correct number of achs" do
137
- expect(payday.number_of_ach_credits).to eq(53)
114
+ expect(payday.number_of_ach_credits).to eq(0)
138
115
  end
139
116
 
140
117
  it "returns the same value as #nachs" do
@@ -148,7 +125,7 @@ describe Gratitude::Payday do
148
125
 
149
126
  describe "#number_of_active_users" do
150
127
  it "returns the correct number active" do
151
- expect(payday.number_of_active_users).to eq(1719)
128
+ expect(payday.number_of_active_users).to eq(4)
152
129
  end
153
130
 
154
131
  it "returns the same value as #nactive" do
@@ -162,7 +139,7 @@ describe Gratitude::Payday do
162
139
 
163
140
  describe "#number_of_failing_credit_cards" do
164
141
  it "returns the correct number of failing credit cards" do
165
- expect(payday.number_of_failing_credit_cards).to eq(178)
142
+ expect(payday.number_of_failing_credit_cards).to eq(0)
166
143
  end
167
144
 
168
145
  it "returns the same value as #ncc_failing" do
@@ -172,7 +149,7 @@ describe Gratitude::Payday do
172
149
 
173
150
  describe "#number_of_missing_credit_cards" do
174
151
  it "returns the correct number of missing credit cards" do
175
- expect(payday.number_of_missing_credit_cards).to eq(1222)
152
+ expect(payday.number_of_missing_credit_cards).to eq(0)
176
153
  end
177
154
 
178
155
  it "returns the same value as #ncc_missing" do
@@ -182,7 +159,7 @@ describe Gratitude::Payday do
182
159
 
183
160
  describe "#number_of_charges" do
184
161
  it "returns the correct number of charges" do
185
- expect(payday.number_of_charges).to eq(276)
162
+ expect(payday.number_of_charges).to eq(2)
186
163
  end
187
164
 
188
165
  it "returns the same value as #ncharges" do
@@ -192,7 +169,7 @@ describe Gratitude::Payday do
192
169
 
193
170
  describe "#number_of_participants" do
194
171
  it "returns the correct number of participants" do
195
- expect(payday.number_of_participants).to eq(19567)
172
+ expect(payday.number_of_participants).to eq(2)
196
173
  end
197
174
 
198
175
  it "returns the same value as #nparticipants" do
@@ -202,7 +179,7 @@ describe Gratitude::Payday do
202
179
 
203
180
  describe "#number_of_tippers" do
204
181
  it "returns the correct number of tippers" do
205
- expect(payday.number_of_tippers).to eq(1105)
182
+ expect(payday.number_of_tippers).to eq(2)
206
183
  end
207
184
 
208
185
  it "returns the same value as #ntippers" do
@@ -212,7 +189,7 @@ describe Gratitude::Payday do
212
189
 
213
190
  describe "#number_of_transfers" do
214
191
  it "returns the correct number of transfers" do
215
- expect(payday.number_of_transfers).to eq(3309)
192
+ expect(payday.number_of_transfers).to eq(4)
216
193
  end
217
194
 
218
195
  it "returns the same value as #ntransfers" do
@@ -222,7 +199,7 @@ describe Gratitude::Payday do
222
199
 
223
200
  describe "#transfer_volume" do
224
201
  it "responsd to #transfer_volume" do
225
- expect(payday.transfer_volume).to eq(5464.38)
202
+ expect(payday.transfer_volume).to eq(2.96)
226
203
  end
227
204
  end
228
205
 
@@ -232,15 +209,15 @@ describe Gratitude::Payday do
232
209
  end
233
210
 
234
211
  it "has the correct year" do
235
- expect(payday.transfer_end_time.year).to eq(2013)
212
+ expect(payday.transfer_end_time.year).to eq(2012)
236
213
  end
237
214
 
238
215
  it "has the correct month" do
239
- expect(payday.transfer_end_time.month).to eq(9)
216
+ expect(payday.transfer_end_time.month).to eq(6)
240
217
  end
241
218
 
242
219
  it "has the correct date" do
243
- expect(payday.transfer_end_time.day).to eq(12)
220
+ expect(payday.transfer_end_time.day).to eq(1)
244
221
  end
245
222
 
246
223
  it "returns the same value as #ts_end" do
@@ -254,15 +231,15 @@ describe Gratitude::Payday do
254
231
  end
255
232
 
256
233
  it "has the correct year" do
257
- expect(payday.transfer_start_time.year).to eq(2013)
234
+ expect(payday.transfer_start_time.year).to eq(2012)
258
235
  end
259
236
 
260
237
  it "has the correct month" do
261
- expect(payday.transfer_start_time.month).to eq(9)
238
+ expect(payday.transfer_start_time.month).to eq(6)
262
239
  end
263
240
 
264
241
  it "has the correct date" do
265
- expect(payday.transfer_start_time.day).to eq(12)
242
+ expect(payday.transfer_start_time.day).to eq(1)
266
243
  end
267
244
 
268
245
  it "returns the same value as #ts_start" do
@@ -3,228 +3,296 @@ require "spec_helper"
3
3
  describe Gratitude::Profile do
4
4
 
5
5
  describe "default attributes" do
6
- it "includes httparty methods" do
7
- expect(Gratitude::Profile).to include(HTTParty)
6
+ it "includes Gratitude::Connection" do
7
+ expect(Gratitude::Profile).to include(Gratitude::Connection)
8
8
  end
9
+ end
9
10
 
10
- it "sets the base uri equal to the API endpoint" do
11
- expect(Gratitude::Profile.base_uri).to eq("https://www.gittip.com")
11
+ describe "instance methods" do
12
+ before { VCR.insert_cassette "profiles" }
13
+ after { VCR.eject_cassette }
14
+ let(:complete_profile) { Gratitude::Profile.new("JohnKellyFerguson") }
15
+ let(:incomplete_profile) { Gratitude::Profile.new("gratitude_test") }
16
+ let(:no_twitter_profile) { Gratitude::Profile.new("goya") }
17
+
18
+ it "sets the correct username" do
19
+ expect(complete_profile.username).to eq("JohnKellyFerguson")
12
20
  end
13
21
 
14
- it "has the correct uri suffix" do
15
- expect(Gratitude::Profile::URI_SUFFIX).to eq("/public.json")
22
+ describe "json response" do
23
+ it "returns the correct keys in the json hash" do
24
+ expect(complete_profile.send(:response_body).keys)
25
+ .to eq(
26
+ [
27
+ "avatar",
28
+ "bitcoin",
29
+ "elsewhere",
30
+ "giving",
31
+ "goal",
32
+ "id",
33
+ "npatrons",
34
+ "number",
35
+ "on",
36
+ "receiving",
37
+ "username"
38
+ ]
39
+ )
40
+ end
16
41
  end
17
- end
18
42
 
19
- describe "instance methods" do
20
-
21
- context "a fully completed profile" do
22
- before { VCR.insert_cassette "complete_profile" }
23
- after { VCR.eject_cassette }
24
- let(:complete_profile) { Gratitude::Profile.new("whit537") }
43
+ describe "#avatar_url" do
44
+ it "returns a string" do
45
+ expect(complete_profile.avatar_url.class).to be(String)
46
+ end
25
47
 
26
- it "should set the correct username" do
27
- expect(complete_profile.username).to eq("whit537")
48
+ it "returns the same value as its alias: #avatar" do
49
+ expect(complete_profile.avatar_url).to eq(complete_profile.avatar)
28
50
  end
51
+ end
29
52
 
30
- it "should respond to #response" do
31
- expect(complete_profile).to respond_to(:response)
53
+ describe "#bitcoin" do
54
+ context "a user with an associated bitcoin address" do
55
+ it "returns a string" do
56
+ expect(complete_profile.bitcoin.class).to be(String)
57
+ end
32
58
  end
33
59
 
34
- describe "#avatar_url" do
35
- it "returns the correct avatar url" do
36
- expect(complete_profile.avatar_url)
37
- .to eq("https://www.gravatar.com/avatar/fb054b407a6461e417ee6b6ae084da37.jpg?s=128")
60
+ context "a user without an associated bitcoin address" do
61
+ it "returns a string" do
62
+ expect(incomplete_profile.bitcoin).to be(nil)
38
63
  end
64
+ end
65
+ end
39
66
 
40
- it "returns the same value as its alias: #avatar" do
41
- expect(complete_profile.avatar_url).to eq(complete_profile.avatar)
67
+ describe "#bitbucket" do
68
+ context "a user with an associated bitbucket account" do
69
+ it "returns a hash" do
70
+ expect(complete_profile.bitbucket.class).to be(Hash)
42
71
  end
43
72
  end
44
73
 
45
- describe "#bitbucket_api_url" do
46
- it "returns the correct bitbucket api url" do
47
- expect(complete_profile.bitbucket_api_url)
48
- .to eq("https://bitbucket.org/api/1.0/users/whit537")
74
+ context "a user without an associated bitbucket acount" do
75
+ it "returns a string" do
76
+ expect(incomplete_profile.bitbucket).to be(nil)
49
77
  end
78
+ end
79
+ end
50
80
 
51
- it "returns the same value as its alias: #bitbucket" do
52
- expect(complete_profile.bitbucket_api_url).to eq(complete_profile.bitbucket)
81
+ describe "#bitbucket_username" do
82
+ context "a user with an associated bitbucket account" do
83
+ it "returns a string" do
84
+ expect(complete_profile.bitbucket_username.class).to be(String)
53
85
  end
54
86
  end
55
87
 
56
- describe "#bitbucket_username" do
57
- it "returns the correct bitbucket username" do
58
- expect(complete_profile.bitbucket_username).to eq("whit537")
88
+ context "a user without an associated bitbucket acount" do
89
+ it "returns a string" do
90
+ expect(incomplete_profile.bitbucket_username).to be(nil)
59
91
  end
60
92
  end
93
+ end
61
94
 
62
- describe "#bountysource_api_url" do
63
- it "returns the correct bountysource api url" do
64
- expect(complete_profile.bountysource_api_url)
65
- .to eq("https://api.bountysource.com/users/whit537")
95
+ describe "#bountysource" do
96
+ context "a user with an associated bountysource account" do
97
+ it "returns a hash" do
98
+ expect(complete_profile.bountysource.class).to be(Hash)
66
99
  end
67
100
  end
68
101
 
69
- describe "#bountysource_username" do
70
- it "returns the correct bountysource username" do
71
- expect(complete_profile.bountysource_username).to eq("whit537")
102
+ context "a user without an associated bountysource acount" do
103
+ it "returns a string" do
104
+ expect(incomplete_profile.bountysource).to be(nil)
72
105
  end
73
106
  end
107
+ end
74
108
 
75
- describe "#github_api_url" do
76
- it "returns the correct github api url" do
77
- expect(complete_profile.github_api_url)
78
- .to eq("https://api.github.com/users/whit537")
109
+ describe "#bountysource_username" do
110
+ context "a user with an associated bountysource account" do
111
+ it "returns a string" do
112
+ expect(complete_profile.bountysource_username.class).to be(String)
79
113
  end
114
+ end
80
115
 
81
- it "returns the same value as its alias: #github" do
82
- expect(complete_profile.github_api_url).to eq(complete_profile.github)
116
+ context "a user without an associated bountysource acount" do
117
+ it "returns a string" do
118
+ expect(incomplete_profile.bountysource_username).to be(nil)
83
119
  end
84
120
  end
121
+ end
85
122
 
86
- describe "#github_username" do
87
- it "returns the correct github username" do
88
- expect(complete_profile.github_username).to eq("whit537")
123
+ describe "#github" do
124
+ context "a user with an associated github account" do
125
+ it "returns a hash" do
126
+ expect(complete_profile.github.class).to be(Hash)
89
127
  end
90
128
  end
91
129
 
92
- describe "#twitter_api_url" do
93
- it "returns the correct twitter api url" do
94
- expect(complete_profile.twitter_api_url)
95
- .to eq("https://api.twitter.com/1.1/users/show.json?id=34175404&include_entities=1")
130
+ context "a user without an associated github acount" do
131
+ it "returns a string" do
132
+ expect(incomplete_profile.github).to be(nil)
96
133
  end
134
+ end
135
+ end
97
136
 
98
- it "returns the same value as its alias: #twitter" do
99
- expect(complete_profile.twitter_api_url).to eq(complete_profile.twitter)
137
+ describe "#github_username" do
138
+ context "a user with an associated github account" do
139
+ it "returns a string" do
140
+ expect(complete_profile.github_username.class).to be(String)
100
141
  end
101
142
  end
102
143
 
103
- describe "#twitter_username" do
104
- it "returns nil" do
105
- expect(complete_profile.twitter_username).to be(nil)
144
+ context "a user without an associated github acount" do
145
+ it "returns a string" do
146
+ expect(incomplete_profile.github_username).to be(nil)
106
147
  end
107
148
  end
149
+ end
108
150
 
109
- describe "#amount_giving" do
110
- it "returns a float" do
111
- expect(complete_profile.amount_giving.class).to be(Float)
151
+ describe "#openstreetmap" do
152
+ context "a user with an associated openstreetmap account" do
153
+ it "returns a hash" do
154
+ expect(complete_profile.openstreetmap.class).to be(Hash)
112
155
  end
156
+ end
113
157
 
114
- it "returns the correct amount giving" do
115
- expect(complete_profile.amount_giving).to eq(101.41)
158
+ context "a user without an associated openstreetmap acount" do
159
+ it "returns a string" do
160
+ expect(incomplete_profile.openstreetmap).to be(nil)
116
161
  end
162
+ end
163
+ end
117
164
 
118
- it "returns the same value as its alias: #giving" do
119
- expect(complete_profile.amount_giving).to eq(complete_profile.giving)
165
+ describe "#openstreetmap_username" do
166
+ context "a user with an associated openstreetmap account" do
167
+ it "returns a string" do
168
+ expect(complete_profile.openstreetmap_username.class).to be(String)
120
169
  end
121
170
  end
122
171
 
123
- describe "#amount_receiving" do
124
- it "returns a float" do
125
- expect(complete_profile.amount_receiving.class).to be(Float)
172
+ context "a user without an associated openstreetmap acount" do
173
+ it "returns a string" do
174
+ expect(incomplete_profile.openstreetmap_username).to be(nil)
126
175
  end
176
+ end
177
+ end
127
178
 
128
- it "returns the correct amount amount receiving" do
129
- expect(complete_profile.amount_receiving).to eq(434.25)
179
+ describe "#twitter" do
180
+ context "a user with an associated twitter account" do
181
+ it "returns a hash" do
182
+ expect(complete_profile.twitter.class).to be(Hash)
130
183
  end
184
+ end
131
185
 
132
- it "returns the same value as its alias: #receiving" do
133
- expect(complete_profile.amount_receiving)
134
- .to eq(complete_profile.receiving)
186
+ context "a user without an associated twitter acount" do
187
+ it "returns a string" do
188
+ expect(no_twitter_profile.twitter).to be(nil)
135
189
  end
136
190
  end
191
+ end
137
192
 
138
- describe "#goal" do
139
- it "returns the correct goal" do
140
- expect(complete_profile.goal).to be(nil)
193
+ describe "#twitter_username" do
194
+ context "a user with an associated twitter account" do
195
+ it "returns a string" do
196
+ expect(complete_profile.twitter_username.class).to be(String)
141
197
  end
142
198
  end
143
199
 
144
- describe "#account_type" do
145
- it "returns the correct account_type" do
146
- expect(complete_profile.account_type).to eq("singular")
200
+ context "a user without an associated twitter acount" do
201
+ it "returns a string" do
202
+ expect(no_twitter_profile.twitter_username).to be(nil)
147
203
  end
204
+ end
205
+ end
148
206
 
149
- it "returns the same value as its alias: #number" do
150
- expect(complete_profile.account_type).to eq(complete_profile.number)
207
+ describe "#venmo" do
208
+ context "a user with an associated venmo account" do
209
+ it "returns a hash" do
210
+ expect(complete_profile.venmo.class).to be(Hash)
151
211
  end
152
212
  end
213
+ end
153
214
 
154
- describe "#id" do
155
- it "returns a fixnum" do
156
- expect(complete_profile.id.class).to be(Fixnum)
215
+ describe "#venmo_username" do
216
+ context "a user with an associated venmo account" do
217
+ it "returns a string" do
218
+ expect(complete_profile.venmo_username.class).to be(String)
157
219
  end
220
+ end
158
221
 
159
- it "returns the correct id number" do
160
- expect(complete_profile.id).to eq(1451)
222
+ context "a user without an associated venmo acount" do
223
+ it "returns a string" do
224
+ expect(incomplete_profile.openstreetmap_username).to be(nil)
161
225
  end
162
226
  end
227
+ end
163
228
 
164
- end # a fully completed profile
229
+ describe "#amount_giving" do
230
+ it "returns a float" do
231
+ expect(complete_profile.amount_giving.class).to be(Float)
232
+ end
165
233
 
166
- context "an account with only twitter as a linked account" do
167
- before { VCR.insert_cassette "incomplete_profile" }
168
- after { VCR.eject_cassette }
169
- let(:incomplete_profile) { Gratitude::Profile.new("gratitude_test") }
234
+ it "returns the same value as its alias: #giving" do
235
+ expect(complete_profile.amount_giving).to eq(complete_profile.giving)
236
+ end
237
+ end
170
238
 
171
- describe "#bitbucket_api_url" do
172
- it "returns nil" do
173
- expect(incomplete_profile.bitbucket_api_url).to be(nil)
174
- end
239
+ describe "#amount_receiving" do
240
+ it "returns a float" do
241
+ expect(complete_profile.amount_receiving.class).to be(Float)
175
242
  end
176
243
 
177
- describe "#bitbucket_username" do
178
- it "returns nil" do
179
- expect(incomplete_profile.bitbucket_username).to be(nil)
180
- end
244
+ it "returns the same value as its alias: #receiving" do
245
+ expect(complete_profile.amount_receiving)
246
+ .to eq(complete_profile.receiving)
181
247
  end
248
+ end
182
249
 
183
- describe "#bountysource_api_url" do
184
- it "returns nil" do
185
- expect(incomplete_profile.bountysource_api_url).to be(nil)
250
+ describe "#goal" do
251
+ context "a user who has defined a goal" do
252
+ it "returns a Float" do
253
+ expect(complete_profile.goal.class).to be(Float)
186
254
  end
187
255
  end
188
256
 
189
- describe "#bountysource_username" do
257
+ context "a user who has not defined a goal" do
190
258
  it "returns nil" do
191
- expect(incomplete_profile.bountysource_username).to be(nil)
259
+ expect(incomplete_profile.goal).to be(nil)
192
260
  end
193
261
  end
262
+ end
194
263
 
195
- describe "#github_api_url" do
196
- it "returns nil" do
197
- expect(incomplete_profile.github_api_url).to be(nil)
198
- end
264
+ describe "#account_type" do
265
+ it "returns a string" do
266
+ expect(complete_profile.account_type.class).to be(String)
199
267
  end
200
268
 
201
- describe "#github_username" do
202
- it "returns nil" do
203
- expect(incomplete_profile.github_username).to be(nil)
204
- end
269
+ it "returns the same value as its alias: #number" do
270
+ expect(complete_profile.account_type).to eq(complete_profile.number)
205
271
  end
272
+ end
206
273
 
207
- describe "#goal" do
208
- context "a user who has defined themselves as a patron" do
209
- it "returns nil" do
210
- expect(incomplete_profile.goal).to eq(nil)
211
- end
212
- end
274
+ describe "#id" do
275
+ it "returns a fixnum" do
276
+ expect(complete_profile.id.class).to be(Fixnum)
213
277
  end
278
+ end
214
279
 
215
- end # an incomplete profile
280
+ describe "#number_of_patrons" do
281
+ it "returns a Fixnum" do
282
+ expect(complete_profile.number_of_patrons.class).to be(Fixnum)
283
+ end
216
284
 
217
- context "a profile that has defined a gittip goal" do
218
- before { VCR.insert_cassette "goal_profile" }
219
- after { VCR.eject_cassette }
220
- let(:goal_profile) { Gratitude::Profile.new("johnkellyferguson") }
285
+ it "returns the same value as its alias: #npatrons" do
286
+ expect(complete_profile.number_of_patrons)
287
+ .to eq(complete_profile.npatrons)
288
+ end
289
+ end
221
290
 
222
- describe "#goal" do
223
- it "returns the correct goal amount" do
224
- expect(goal_profile.goal).to eq(5.00)
225
- end
291
+ describe "#on" do
292
+ it "returns a string" do
293
+ expect(complete_profile.on.class).to be(String)
226
294
  end
227
- end # a profile with a gittip goal
295
+ end
228
296
 
229
297
  end # instance methods
230
298