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.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/CHANGELOG.md +14 -10
- data/Gemfile +7 -5
- data/Guardfile +6 -0
- data/README.md +36 -11
- data/gratitude.gemspec +3 -2
- data/lib/gratitude.rb +3 -1
- data/lib/gratitude/client.rb +4 -2
- data/lib/gratitude/connection.rb +10 -0
- data/lib/gratitude/payday.rb +23 -17
- data/lib/gratitude/profile.rb +63 -32
- data/lib/gratitude/statistics.rb +30 -28
- data/lib/gratitude/tips.rb +12 -23
- data/lib/gratitude/version.rb +1 -1
- data/spec/cassettes/current_tips.json +74 -0
- data/spec/cassettes/paydays.json +18 -7
- data/spec/cassettes/profiles.json +209 -0
- data/spec/cassettes/statistics.json +132 -110
- data/spec/cassettes/update_and_prune.json +208 -189
- data/spec/cassettes/update_tips.json +74 -0
- data/spec/gratitude/client_spec.rb +2 -2
- data/spec/gratitude/connection_spec.rb +20 -0
- data/spec/gratitude/payday_spec.rb +56 -79
- data/spec/gratitude/profile_spec.rb +195 -127
- data/spec/gratitude/statistics_spec.rb +36 -80
- data/spec/gratitude/tips_spec.rb +23 -41
- data/spec/spec_helper.rb +1 -0
- metadata +31 -21
- data/spec/cassettes/complete_profile.json +0 -119
- data/spec/cassettes/get_tips.json +0 -63
- data/spec/cassettes/goal_profile.json +0 -121
- data/spec/cassettes/incomplete_profile.json +0 -62
- data/spec/cassettes/post_multiple_tips.json +0 -68
- data/spec/cassettes/post_single_tip.json +0 -68
- data/spec/cassettes/post_tip_error.json +0 -68
@@ -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
|
7
|
-
expect(Gratitude::Client).to include(
|
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 "
|
7
|
-
expect(Gratitude::Payday).to
|
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
|
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
|
-
|
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
|
60
|
-
expect(Gratitude::Payday.sort_by_ts_end.first.ts_end
|
61
|
-
|
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
|
75
|
-
|
76
|
-
|
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.
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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
|
7
|
-
expect(Gratitude::Profile).to include(
|
6
|
+
it "includes Gratitude::Connection" do
|
7
|
+
expect(Gratitude::Profile).to include(Gratitude::Connection)
|
8
8
|
end
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
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
|
-
|
15
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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 "
|
27
|
-
expect(complete_profile.
|
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
|
-
|
31
|
-
|
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
|
-
|
35
|
-
it "returns
|
36
|
-
expect(
|
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
|
-
|
41
|
-
|
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
|
-
|
46
|
-
it "returns
|
47
|
-
expect(
|
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
|
-
|
52
|
-
|
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
|
-
|
57
|
-
it "returns
|
58
|
-
expect(
|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
-
|
70
|
-
it "returns
|
71
|
-
expect(
|
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
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
-
|
82
|
-
|
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
|
-
|
87
|
-
|
88
|
-
|
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
|
-
|
93
|
-
it "returns
|
94
|
-
expect(
|
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
|
-
|
99
|
-
|
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
|
-
|
104
|
-
it "returns
|
105
|
-
expect(
|
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
|
-
|
110
|
-
|
111
|
-
|
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
|
-
|
115
|
-
|
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
|
-
|
119
|
-
|
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
|
-
|
124
|
-
it "returns a
|
125
|
-
expect(
|
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
|
-
|
129
|
-
|
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
|
-
|
133
|
-
|
134
|
-
|
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
|
-
|
139
|
-
|
140
|
-
|
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
|
-
|
145
|
-
it "returns
|
146
|
-
expect(
|
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
|
-
|
150
|
-
|
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
|
-
|
155
|
-
|
156
|
-
|
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
|
-
|
160
|
-
|
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
|
-
|
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
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
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
|
-
|
172
|
-
|
173
|
-
|
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
|
-
|
178
|
-
|
179
|
-
|
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
|
-
|
184
|
-
|
185
|
-
|
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
|
-
|
257
|
+
context "a user who has not defined a goal" do
|
190
258
|
it "returns nil" do
|
191
|
-
expect(incomplete_profile.
|
259
|
+
expect(incomplete_profile.goal).to be(nil)
|
192
260
|
end
|
193
261
|
end
|
262
|
+
end
|
194
263
|
|
195
|
-
|
196
|
-
|
197
|
-
|
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
|
-
|
202
|
-
|
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
|
-
|
208
|
-
|
209
|
-
|
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
|
-
|
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
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
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
|
-
|
223
|
-
|
224
|
-
|
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
|
295
|
+
end
|
228
296
|
|
229
297
|
end # instance methods
|
230
298
|
|