gratitude 0.0.9 → 0.0.10

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.
@@ -3,30 +3,23 @@ require "spec_helper"
3
3
  describe Gratitude::Payday do
4
4
 
5
5
  describe "default attributes" do
6
-
7
- it "should include httparty methods" do
8
- Gratitude::Payday.should include(HTTParty)
6
+ it "includes httparty methods" do
7
+ expect(Gratitude::Payday).to include(HTTParty)
9
8
  end
10
9
 
11
- it "should have the base uri set to gittip's payday api endpoint" do
12
- expect(Gratitude::Payday.base_uri).to eq("https://www.gittip.com/about/paydays.json")
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")
13
13
  end
14
14
 
15
- it "should have the PAYDAYS constant initially set to an empty array" do
15
+ it "initially sets the PAYDAYS constant to an empty array" do
16
16
  expect(Gratitude::Payday::PAYDAYS).to eq([])
17
17
  end
18
-
19
- end # default attributes
18
+ end
20
19
 
21
20
  describe "class methods" do
22
-
23
- before do
24
- VCR.insert_cassette "paydays"
25
- end
26
-
27
- after do
28
- VCR.eject_cassette
29
- end
21
+ before { VCR.insert_cassette "paydays" }
22
+ after { VCR.eject_cassette }
30
23
 
31
24
  describe "#get_paydays_from_gittip" do
32
25
  it "returns an array" do
@@ -39,7 +32,7 @@ describe Gratitude::Payday do
39
32
  end
40
33
 
41
34
  describe "#collect_paydays" do
42
- it "creates all payday objects and puts them in the PAYDAYS constant" do
35
+ it "creates all payday objects and stores them in the PAYDAYS constant" do
43
36
  expect {
44
37
  Gratitude::Payday.collect_paydays
45
38
  }.to change { Gratitude::Payday::PAYDAYS.size }.from(0).to(68)
@@ -47,9 +40,7 @@ describe Gratitude::Payday do
47
40
  end
48
41
 
49
42
  describe "#all" do
50
- before do
51
- Gratitude::Payday::PAYDAYS = []
52
- end
43
+ before { Gratitude::Payday::PAYDAYS = [] }
53
44
 
54
45
  it "returns an array" do
55
46
  expect(Gratitude::Payday.all.class).to be(Array)
@@ -90,7 +81,7 @@ describe Gratitude::Payday do
90
81
 
91
82
  describe "initialization and instance methods" do
92
83
 
93
- it "should add the initialized object to the PAYDAYS constant" do
84
+ it "adds the initialized object to the PAYDAYS constant" do
94
85
  expect { Gratitude::Payday.new( {
95
86
  'ts_end' => "2013-09-12T14:01:41.848587+00:00",
96
87
  'ts_start' => "2013-09-12T12:36:52.967371+00:00"
@@ -118,168 +109,167 @@ describe Gratitude::Payday do
118
109
  }
119
110
 
120
111
  describe "#ach_fees_volume" do
121
- it "should return the correct ach fees volume" do
112
+ it "returns the correct ach fees volume" do
122
113
  expect(payday.ach_fees_volume).to eq(0)
123
114
  end
124
115
  end
125
116
 
126
117
  describe "#ach_volume" do
127
- it "should return the correct ach volume" do
118
+ it "returns the correct ach volume" do
128
119
  expect(payday.ach_volume).to eq(-2246.96)
129
120
  end
130
121
  end
131
122
 
132
123
  describe "#charge_fees_volume" do
133
- it "should return the correct charge fees volume" do
124
+ it "returns the correct charge fees volume" do
134
125
  expect(payday.charge_fees_volume).to eq(216.09)
135
126
  end
136
127
  end
137
128
 
138
129
  describe "#charge_volume" do
139
- it "should return the correct charge volume" do
130
+ it "returns the correct charge volume" do
140
131
  expect(payday.charge_volume).to eq(4583.22)
141
132
  end
142
133
  end
143
134
 
144
135
  describe "#number_of_ach_credits" do
145
- it "should return the correct number of achs" do
136
+ it "returns the correct number of achs" do
146
137
  expect(payday.number_of_ach_credits).to eq(53)
147
138
  end
148
139
 
149
-
150
- it "should return the same value as #nachs" do
140
+ it "returns the same value as #nachs" do
151
141
  expect(payday.number_of_ach_credits).to eq(payday.nachs)
152
142
  end
153
143
 
154
- it "should return the same value as #number_of_achs" do
144
+ it "returns the same value as #number_of_achs" do
155
145
  expect(payday.number_of_ach_credits).to eq(payday.number_of_achs)
156
146
  end
157
147
  end
158
148
 
159
149
  describe "#number_of_active_users" do
160
- it "should return the correct number active" do
150
+ it "returns the correct number active" do
161
151
  expect(payday.number_of_active_users).to eq(1719)
162
152
  end
163
153
 
164
- it "should return the same value as #nactive" do
154
+ it "returns the same value as #nactive" do
165
155
  expect(payday.number_of_active_users).to eq(payday.nactive)
166
156
  end
167
157
 
168
- it "should return the same value as #number_active" do
158
+ it "returns the same value as #number_active" do
169
159
  expect(payday.number_of_active_users).to eq(payday.number_active)
170
160
  end
171
161
  end
172
162
 
173
163
  describe "#number_of_failing_credit_cards" do
174
- it "should return the correct number of failing credit cards" do
164
+ it "returns the correct number of failing credit cards" do
175
165
  expect(payday.number_of_failing_credit_cards).to eq(178)
176
166
  end
177
167
 
178
- it "should return the same value as #ncc_failing" do
168
+ it "returns the same value as #ncc_failing" do
179
169
  expect(payday.number_of_failing_credit_cards).to eq(payday.ncc_failing)
180
170
  end
181
171
  end
182
172
 
183
173
  describe "#number_of_missing_credit_cards" do
184
- it "should return the correct number of missing credit cards" do
174
+ it "returns the correct number of missing credit cards" do
185
175
  expect(payday.number_of_missing_credit_cards).to eq(1222)
186
176
  end
187
177
 
188
- it "should return the same value as #ncc_missing" do
178
+ it "returns the same value as #ncc_missing" do
189
179
  expect(payday.number_of_missing_credit_cards).to eq(payday.ncc_missing)
190
180
  end
191
181
  end
192
182
 
193
183
  describe "#number_of_charges" do
194
- it "should return the correct number of charges" do
184
+ it "returns the correct number of charges" do
195
185
  expect(payday.number_of_charges).to eq(276)
196
186
  end
197
187
 
198
- it "should return the same value as #ncharges" do
188
+ it "returns the same value as #ncharges" do
199
189
  expect(payday.number_of_charges).to eq(payday.ncharges)
200
190
  end
201
191
  end
202
192
 
203
193
  describe "#number_of_participants" do
204
- it "should return the correct number of participants" do
194
+ it "returns the correct number of participants" do
205
195
  expect(payday.number_of_participants).to eq(19567)
206
196
  end
207
197
 
208
- it "should return the same value as #nparticipants" do
198
+ it "returns the same value as #nparticipants" do
209
199
  expect(payday.number_of_participants).to eq(payday.nparticipants)
210
200
  end
211
201
  end
212
202
 
213
203
  describe "#number_of_tippers" do
214
- it "should respond to #number_of_tippers" do
204
+ it "returns the correct number of tippers" do
215
205
  expect(payday.number_of_tippers).to eq(1105)
216
206
  end
217
207
 
218
- it "should return the same value as #ntippers" do
208
+ it "returns the same value as #ntippers" do
219
209
  expect(payday.number_of_tippers).to eq(payday.ntippers)
220
210
  end
221
211
  end
222
212
 
223
213
  describe "#number_of_transfers" do
224
- it "should return the correct number of transfers" do
214
+ it "returns the correct number of transfers" do
225
215
  expect(payday.number_of_transfers).to eq(3309)
226
216
  end
227
217
 
228
- it "should return the same value as #ntransfers" do
218
+ it "returns the same value as #ntransfers" do
229
219
  expect(payday.number_of_transfers).to eq(payday.ntransfers)
230
220
  end
231
221
  end
232
222
 
233
223
  describe "#transfer_volume" do
234
- it "should respond to #transfer_volume" do
224
+ it "responsd to #transfer_volume" do
235
225
  expect(payday.transfer_volume).to eq(5464.38)
236
226
  end
237
227
  end
238
228
 
239
229
  describe "#transfer_end_time" do
240
- it "should return a DateTime object" do
230
+ it "returns a DateTime object" do
241
231
  expect(payday.transfer_end_time.class).to eq(DateTime)
242
232
  end
243
233
 
244
- it "should have the correct year" do
234
+ it "has the correct year" do
245
235
  expect(payday.transfer_end_time.year).to eq(2013)
246
236
  end
247
237
 
248
- it "should have the correct month" do
238
+ it "has the correct month" do
249
239
  expect(payday.transfer_end_time.month).to eq(9)
250
240
  end
251
241
 
252
- it "should have the correct date" do
242
+ it "has the correct date" do
253
243
  expect(payday.transfer_end_time.day).to eq(12)
254
244
  end
255
245
 
256
- it "should return the same value as #ts_end" do
246
+ it "returns the same value as #ts_end" do
257
247
  expect(payday.transfer_end_time).to eq(payday.ts_end)
258
248
  end
259
249
  end
260
250
 
261
251
  describe "#transfer_start_time" do
262
- it "should return a DateTime object" do
252
+ it "returns a DateTime object" do
263
253
  expect(payday.transfer_start_time.class).to eq(DateTime)
264
254
  end
265
255
 
266
- it "should have the correct year" do
256
+ it "has the correct year" do
267
257
  expect(payday.transfer_start_time.year).to eq(2013)
268
258
  end
269
259
 
270
- it "should have the correct month" do
260
+ it "has the correct month" do
271
261
  expect(payday.transfer_start_time.month).to eq(9)
272
262
  end
273
263
 
274
- it "should have the correct date" do
264
+ it "has the correct date" do
275
265
  expect(payday.transfer_start_time.day).to eq(12)
276
266
  end
277
267
 
278
- it "should return the same value as #ts_start" do
268
+ it "returns the same value as #ts_start" do
279
269
  expect(payday.transfer_start_time).to eq(payday.ts_start)
280
270
  end
281
271
  end
282
272
 
283
273
  end # initialization and instance methods
284
274
 
285
- end
275
+ end
@@ -3,37 +3,26 @@ require "spec_helper"
3
3
  describe Gratitude::Profile do
4
4
 
5
5
  describe "default attributes" do
6
-
7
- it "should include httparty methods" do
8
- Gratitude::Profile.should include(HTTParty)
6
+ it "includes httparty methods" do
7
+ expect(Gratitude::Profile).to include(HTTParty)
9
8
  end
10
9
 
11
- it "should have the base uri set to the API endpoint" do
10
+ it "sets the base uri equal to the API endpoint" do
12
11
  expect(Gratitude::Profile.base_uri).to eq("https://www.gittip.com")
13
12
  end
14
13
 
15
- it "should have the correct uri suffix" do
14
+ it "has the correct uri suffix" do
16
15
  expect(Gratitude::Profile::URI_SUFFIX).to eq("/public.json")
17
16
  end
18
-
19
- end # default attributes
17
+ end
20
18
 
21
19
  describe "instance methods" do
22
20
 
23
21
  context "a fully completed profile" do
24
-
25
- before do
26
- VCR.insert_cassette "complete_profile"
27
- end
28
-
29
- after do
30
- VCR.eject_cassette
31
- end
32
-
22
+ before { VCR.insert_cassette "complete_profile" }
23
+ after { VCR.eject_cassette }
33
24
  let(:complete_profile) { Gratitude::Profile.new("whit537") }
34
25
 
35
- subject { :complete_profile }
36
-
37
26
  it "should set the correct username" do
38
27
  expect(complete_profile.username).to eq("whit537")
39
28
  end
@@ -43,183 +32,181 @@ describe Gratitude::Profile do
43
32
  end
44
33
 
45
34
  describe "#avatar_url" do
46
- it "should return the correct avatar url" do
47
- expect(complete_profile.avatar_url).to eq("https://www.gravatar.com/avatar/fb054b407a6461e417ee6b6ae084da37.jpg?s=128")
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")
48
38
  end
49
39
 
50
- it "should return the same value as its alias: #avatar" do
40
+ it "returns the same value as its alias: #avatar" do
51
41
  expect(complete_profile.avatar_url).to eq(complete_profile.avatar)
52
42
  end
53
43
  end
54
44
 
55
45
  describe "#bitbucket_api_url" do
56
- it "should return the correct bitbucket api url" do
57
- expect(complete_profile.bitbucket_api_url).to eq("https://bitbucket.org/api/1.0/users/whit537")
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")
58
49
  end
59
50
 
60
- it "should return the same value as its alias: #bitbucket" do
51
+ it "returns the same value as its alias: #bitbucket" do
61
52
  expect(complete_profile.bitbucket_api_url).to eq(complete_profile.bitbucket)
62
53
  end
63
54
  end
64
55
 
65
56
  describe "#bitbucket_username" do
66
- it "should return the correct bitbucket username" do
57
+ it "returns the correct bitbucket username" do
67
58
  expect(complete_profile.bitbucket_username).to eq("whit537")
68
59
  end
69
60
  end
70
61
 
71
62
  describe "#bountysource_api_url" do
72
- it "should return the correct bountysource api url" do
73
- expect(complete_profile.bountysource_api_url).to eq("https://api.bountysource.com/users/whit537")
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")
74
66
  end
75
67
  end
76
68
 
77
69
  describe "#bountysource_username" do
78
- it "should return the correct bountysource username" do
70
+ it "returns the correct bountysource username" do
79
71
  expect(complete_profile.bountysource_username).to eq("whit537")
80
72
  end
81
73
  end
82
74
 
83
75
  describe "#github_api_url" do
84
- it "should return the correct github api url" do
85
- expect(complete_profile.github_api_url).to eq("https://api.github.com/users/whit537")
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")
86
79
  end
87
80
 
88
- it "should return the same value as its alias: #github" do
81
+ it "returns the same value as its alias: #github" do
89
82
  expect(complete_profile.github_api_url).to eq(complete_profile.github)
90
83
  end
91
84
  end
92
85
 
93
86
  describe "#github_username" do
94
- it "should return the correct github username" do
87
+ it "returns the correct github username" do
95
88
  expect(complete_profile.github_username).to eq("whit537")
96
89
  end
97
90
  end
98
91
 
99
92
  describe "#twitter_api_url" do
100
- it "should return the correct twitter api url" do
101
- expect(complete_profile.twitter_api_url).to eq("https://api.twitter.com/1.1/users/show.json?id=34175404&include_entities=1")
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")
102
96
  end
103
97
 
104
- it "should return the same value as its alias: #twitter" do
98
+ it "returns the same value as its alias: #twitter" do
105
99
  expect(complete_profile.twitter_api_url).to eq(complete_profile.twitter)
106
100
  end
107
101
  end
108
102
 
109
103
  describe "#twitter_username" do
110
- it "should return nil" do
104
+ it "returns nil" do
111
105
  expect(complete_profile.twitter_username).to be(nil)
112
106
  end
113
107
  end
114
108
 
115
109
  describe "#amount_giving" do
116
- it "should be a float" do
110
+ it "returns a float" do
117
111
  expect(complete_profile.amount_giving.class).to be(Float)
118
112
  end
119
113
 
120
- it "should return the correct amount giving" do
114
+ it "returns the correct amount giving" do
121
115
  expect(complete_profile.amount_giving).to eq(101.41)
122
116
  end
123
117
 
124
- it "should return the same value as its alias: #giving" do
118
+ it "returns the same value as its alias: #giving" do
125
119
  expect(complete_profile.amount_giving).to eq(complete_profile.giving)
126
120
  end
127
121
  end
128
122
 
129
123
  describe "#amount_receiving" do
130
- it "should be a float" do
124
+ it "returns a float" do
131
125
  expect(complete_profile.amount_receiving.class).to be(Float)
132
126
  end
133
127
 
134
- it "should return the correct amount amount receiving" do
128
+ it "returns the correct amount amount receiving" do
135
129
  expect(complete_profile.amount_receiving).to eq(434.25)
136
130
  end
137
131
 
138
- it "should return the same value as its alias: #receiving" do
139
- expect(complete_profile.amount_receiving).to eq(complete_profile.receiving)
132
+ it "returns the same value as its alias: #receiving" do
133
+ expect(complete_profile.amount_receiving)
134
+ .to eq(complete_profile.receiving)
140
135
  end
141
136
  end
142
137
 
143
138
  describe "#goal" do
144
- it "should return the correct goal" do
139
+ it "returns the correct goal" do
145
140
  expect(complete_profile.goal).to be(nil)
146
141
  end
147
142
  end
148
143
 
149
144
  describe "#account_type" do
150
- it "should return the correct account_type" do
145
+ it "returns the correct account_type" do
151
146
  expect(complete_profile.account_type).to eq("singular")
152
147
  end
153
148
 
154
- it "should return the same value as its alias: #number" do
149
+ it "returns the same value as its alias: #number" do
155
150
  expect(complete_profile.account_type).to eq(complete_profile.number)
156
151
  end
157
152
  end
158
153
 
159
154
  describe "#id" do
160
- it "should be a fixnum" do
155
+ it "returns a fixnum" do
161
156
  expect(complete_profile.id.class).to be(Fixnum)
162
157
  end
163
158
 
164
- it "should return the correct id number" do
159
+ it "returns the correct id number" do
165
160
  expect(complete_profile.id).to eq(1451)
166
161
  end
167
162
  end
168
163
 
169
164
  end # a fully completed profile
170
165
 
171
- context "an account that registered through twitter and linked no other accounts" do
172
-
173
- before do
174
- VCR.insert_cassette "incomplete_profile"
175
- end
176
-
177
- after do
178
- VCR.eject_cassette
179
- end
180
-
166
+ context "an account with only twitter as a linked account" do
167
+ before { VCR.insert_cassette "incomplete_profile" }
168
+ after { VCR.eject_cassette }
181
169
  let(:incomplete_profile) { Gratitude::Profile.new("gratitude_test") }
182
170
 
183
-
184
171
  describe "#bitbucket_api_url" do
185
- it "should return nil" do
172
+ it "returns nil" do
186
173
  expect(incomplete_profile.bitbucket_api_url).to be(nil)
187
174
  end
188
175
  end
189
176
 
190
177
  describe "#bitbucket_username" do
191
- it "should return nil" do
178
+ it "returns nil" do
192
179
  expect(incomplete_profile.bitbucket_username).to be(nil)
193
180
  end
194
181
  end
195
182
 
196
183
  describe "#bountysource_api_url" do
197
- it "should return nil" do
184
+ it "returns nil" do
198
185
  expect(incomplete_profile.bountysource_api_url).to be(nil)
199
186
  end
200
187
  end
201
188
 
202
189
  describe "#bountysource_username" do
203
- it "should return nil" do
190
+ it "returns nil" do
204
191
  expect(incomplete_profile.bountysource_username).to be(nil)
205
192
  end
206
193
  end
207
194
 
208
195
  describe "#github_api_url" do
209
- it "should return nil" do
196
+ it "returns nil" do
210
197
  expect(incomplete_profile.github_api_url).to be(nil)
211
198
  end
212
199
  end
213
200
 
214
201
  describe "#github_username" do
215
- it "should return nil" do
202
+ it "returns nil" do
216
203
  expect(incomplete_profile.github_username).to be(nil)
217
204
  end
218
205
  end
219
206
 
220
207
  describe "#goal" do
221
208
  context "a user who has defined themselves as a patron" do
222
- it "should return nil" do
209
+ it "returns nil" do
223
210
  expect(incomplete_profile.goal).to eq(nil)
224
211
  end
225
212
  end
@@ -228,25 +215,17 @@ describe Gratitude::Profile do
228
215
  end # an incomplete profile
229
216
 
230
217
  context "a profile that has defined a gittip goal" do
231
-
232
- before do
233
- VCR.insert_cassette "goal_profile"
234
- end
235
-
236
- after do
237
- VCR.eject_cassette
238
- end
239
-
218
+ before { VCR.insert_cassette "goal_profile" }
219
+ after { VCR.eject_cassette }
240
220
  let(:goal_profile) { Gratitude::Profile.new("johnkellyferguson") }
241
221
 
242
222
  describe "#goal" do
243
- it "should return the correct goal amount" do
223
+ it "returns the correct goal amount" do
244
224
  expect(goal_profile.goal).to eq(5.00)
245
225
  end
246
226
  end
247
-
248
227
  end # a profile with a gittip goal
249
228
 
250
229
  end # instance methods
251
230
 
252
- end
231
+ end