pew_pew 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,283 +1,297 @@
1
- require 'spec_helper'
1
+ module PewPew
2
+ module Resources
3
+ RSpec.describe Lists, :resource do
4
+ let(:resource) { described_class.new(client) }
2
5
 
3
- describe PewPew::Resources::Lists, :resource do
4
- let(:resource) { described_class.new(client) }
6
+ context '#all' do
7
+ let(:response) { resource.all }
5
8
 
6
- context '#all' do
7
- let(:response) { resource.all }
9
+ subject { response }
8
10
 
9
- subject { response }
11
+ specify { should be_success }
10
12
 
11
- specify { should be_success }
13
+ its(:status) { should == 200 }
14
+ its(:total_count) { should == 1 }
12
15
 
13
- its(:status) { should == 200 }
14
- its(:total_count) { should == 1 }
16
+ context 'item' do
17
+ subject { response.items.first }
15
18
 
16
- context 'item' do
17
- subject { response.items.first }
18
-
19
- its(:address) { should == 'newsletter@pewpew.mailgun.org' }
20
- its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
21
- its(:description) { should == 'Weekly News and Updates' }
22
- its(:members_count) { should == 0 }
23
- its(:name) { should == 'Newsletter' }
24
- end
25
- end
19
+ its(:address) { should == 'newsletter@pewpew.mailgun.org' }
20
+ its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
21
+ its(:description) { should == 'Weekly News and Updates' }
22
+ its(:members_count) { should == 0 }
23
+ its(:name) { should == 'Newsletter' }
24
+ end
25
+ end
26
26
 
27
- context '#find' do
28
- let(:response) { resource.find('newsletter@pewpew.mailgun.org') }
27
+ context '#find' do
28
+ let(:response) { resource.find('newsletter@pewpew.mailgun.org') }
29
29
 
30
- subject { response }
30
+ subject { response }
31
31
 
32
- specify { should be_success }
32
+ specify { should be_success }
33
33
 
34
- its(:status) { should == 200 }
34
+ its(:status) { should == 200 }
35
35
 
36
- context 'list' do
37
- subject { response.list }
36
+ context 'list' do
37
+ subject { response.list }
38
38
 
39
- its(:address) { should == 'newsletter@pewpew.mailgun.org' }
40
- its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
41
- its(:description) { should == 'Weekly News and Updates' }
42
- its(:members_count) { should == 0 }
43
- its(:name) { should == 'Newsletter' }
44
- end
45
- end
39
+ its(:address) { should == 'newsletter@pewpew.mailgun.org' }
40
+ its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
41
+ its(:description) { should == 'Weekly News and Updates' }
42
+ its(:members_count) { should == 0 }
43
+ its(:name) { should == 'Newsletter' }
44
+ end
45
+ end
46
46
 
47
- context '#create' do
48
- let(:params) do
49
- {
50
- address: 'newsletter@pewpew.mailgun.org',
51
- description: 'Weekly News and Updates',
52
- name: 'Newsletter'
53
- }
54
- end
47
+ context '#create' do
48
+ let(:params) do
49
+ {
50
+ address: 'newsletter@pewpew.mailgun.org',
51
+ description: 'Weekly News and Updates',
52
+ name: 'Newsletter'
53
+ }
54
+ end
55
55
 
56
- let(:response) { resource.create(params) }
56
+ let(:response) { resource.create(params) }
57
57
 
58
- subject { response }
58
+ subject { response }
59
59
 
60
- specify { should be_success }
60
+ specify { should be_success }
61
61
 
62
- its(:status) { should == 200 }
63
- its(:message) { should == 'Mailing list has been created' }
62
+ its(:status) { should == 200 }
63
+ its(:message) { should == 'Mailing list has been created' }
64
64
 
65
- context 'list' do
66
- subject { response.list }
65
+ context 'list' do
66
+ subject { response.list }
67
67
 
68
- its(:address) { should == 'newsletter@pewpew.mailgun.org' }
69
- its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
70
- its(:description) { should == 'Weekly News and Updates' }
71
- its(:members_count) { should == 0 }
72
- its(:name) { should == 'Newsletter' }
73
- end
74
- end
68
+ its(:address) { should == 'newsletter@pewpew.mailgun.org' }
69
+ its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
70
+ its(:description) { should == 'Weekly News and Updates' }
71
+ its(:members_count) { should == 0 }
72
+ its(:name) { should == 'Newsletter' }
73
+ end
74
+ end
75
75
 
76
- context '#update' do
77
- let(:params) { { description: 'Monthly News and Updates' } }
78
- let(:response) { resource.update('newsletter@pewpew.mailgun.org', params) }
76
+ context '#update' do
77
+ let(:params) { { description: 'Monthly News and Updates' } }
78
+ let(:response) {
79
+ resource.update('newsletter@pewpew.mailgun.org', params)
80
+ }
79
81
 
80
- subject { response }
82
+ subject { response }
81
83
 
82
- specify { should be_success }
84
+ specify { should be_success }
83
85
 
84
- its(:status) { should == 200 }
85
- its(:message) { should == 'Mailing list has been updated' }
86
+ its(:status) { should == 200 }
87
+ its(:message) { should == 'Mailing list has been updated' }
86
88
 
87
- context 'list' do
88
- subject { response.list }
89
+ context 'list' do
90
+ subject { response.list }
89
91
 
90
- its(:address) { should == 'newsletter@pewpew.mailgun.org' }
91
- its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
92
- its(:description) { should == 'Monthly News and Updates' }
93
- its(:members_count) { should == 0 }
94
- its(:name) { should == 'Newsletter' }
95
- end
96
- end
92
+ its(:address) { should == 'newsletter@pewpew.mailgun.org' }
93
+ its(:created_at) { should == 'Mon, 04 Jun 2012 16:56:58 GMT' }
94
+ its(:description) { should == 'Monthly News and Updates' }
95
+ its(:members_count) { should == 0 }
96
+ its(:name) { should == 'Newsletter' }
97
+ end
98
+ end
97
99
 
98
- context '#remove' do
99
- let(:response) { resource.remove('newsletter@pewpew.mailgun.org') }
100
+ context '#remove' do
101
+ let(:response) { resource.remove('newsletter@pewpew.mailgun.org') }
100
102
 
101
- subject { response }
103
+ subject { response }
102
104
 
103
- specify { should be_success }
105
+ specify { should be_success }
104
106
 
105
- its(:status) { should == 200 }
106
- its(:message) { should == 'Mailing list has been deleted' }
107
+ its(:status) { should == 200 }
108
+ its(:message) { should == 'Mailing list has been deleted' }
107
109
 
108
- its(:address) { should == 'newsletter@pewpew.mailgun.org' }
109
- end
110
+ its(:address) { should == 'newsletter@pewpew.mailgun.org' }
111
+ end
110
112
 
111
- context '#stats' do
112
- let(:response) { resource.stats('newsletter@pewpew.mailgun.org') }
113
+ context '#stats' do
114
+ let(:response) { resource.stats('newsletter@pewpew.mailgun.org') }
113
115
 
114
- subject { response }
116
+ subject { response }
115
117
 
116
- specify { should be_success }
118
+ specify { should be_success }
117
119
 
118
- its(:status) { should == 200 }
120
+ its(:status) { should == 200 }
119
121
 
120
- context 'total' do
121
- subject { response.total }
122
+ context 'total' do
123
+ subject { response.total }
122
124
 
123
- its(:bounced) { should == 0 }
124
- its(:clicked) { should == 0 }
125
- its(:complained) { should == 0 }
126
- its(:delivered) { should == 0 }
127
- its(:dropped) { should == 0 }
128
- its(:opened) { should == 0 }
129
- its(:unsubscribed) { should == 0 }
130
- end
125
+ its(:bounced) { should == 0 }
126
+ its(:clicked) { should == 0 }
127
+ its(:complained) { should == 0 }
128
+ its(:delivered) { should == 0 }
129
+ its(:dropped) { should == 0 }
130
+ its(:opened) { should == 0 }
131
+ its(:unsubscribed) { should == 0 }
132
+ end
131
133
 
132
- context 'unique' do
133
- context 'clicked' do
134
- subject { response.unique.clicked }
134
+ context 'unique' do
135
+ context 'clicked' do
136
+ subject { response.unique.clicked }
135
137
 
136
- its(:link) { should == 0 }
137
- its(:recipient) { should == 0 }
138
- end
138
+ its(:link) { should == 0 }
139
+ its(:recipient) { should == 0 }
140
+ end
139
141
 
140
- context 'opened' do
141
- subject { response.unique.opened }
142
+ context 'opened' do
143
+ subject { response.unique.opened }
142
144
 
143
- its(:recipient) { should == 0 }
145
+ its(:recipient) { should == 0 }
146
+ end
147
+ end
144
148
  end
145
- end
146
- end
147
149
 
148
- context '#all_members' do
149
- let(:response) do
150
- resource.all_members('newsletter@pewpew.mailgun.org')
151
- end
150
+ context '#all_members' do
151
+ let(:response) do
152
+ resource.all_members('newsletter@pewpew.mailgun.org')
153
+ end
152
154
 
153
- subject { response }
155
+ subject { response }
154
156
 
155
- specify { should be_success }
157
+ specify { should be_success }
156
158
 
157
- its(:status) { should == 200 }
158
- its(:total_count) { should == 1 }
159
+ its(:status) { should == 200 }
160
+ its(:total_count) { should == 1 }
159
161
 
160
- context 'member' do
161
- subject { response.items.first }
162
+ context 'member' do
163
+ subject { response.items.first }
162
164
 
163
- its(:address) { should == 'member@example.com' }
164
- its(:name) { should == 'Member Name' }
165
- its(:subscribed) { should be_true }
165
+ its(:address) { should == 'member@example.com' }
166
+ its(:name) { should == 'Member Name' }
167
+ its(:subscribed) { should be_truthy }
166
168
 
167
- context 'vars' do
168
- subject { response.items.first.vars }
169
+ context 'vars' do
170
+ subject { response.items.first.vars }
169
171
 
170
- its(:awesome) { should be_true }
172
+ its(:awesome) { should be_truthy }
173
+ end
174
+ end
171
175
  end
172
- end
173
- end
174
176
 
175
- context '#find_member' do
176
- let(:response) do
177
- resource.find_member('newsletter@pewpew.mailgun.org', 'member@example.com')
178
- end
177
+ context '#find_member' do
178
+ let(:response) do
179
+ resource.find_member(
180
+ 'newsletter@pewpew.mailgun.org',
181
+ 'member@example.com',
182
+ )
183
+ end
179
184
 
180
- subject { response }
185
+ subject { response }
181
186
 
182
- specify { should be_success }
187
+ specify { should be_success }
183
188
 
184
- its(:status) { should == 200 }
189
+ its(:status) { should == 200 }
185
190
 
186
- context 'member' do
187
- subject { response.member }
191
+ context 'member' do
192
+ subject { response.member }
188
193
 
189
- its(:address) { should == 'member@example.com' }
190
- its(:name) { should == 'Member Name' }
191
- its(:subscribed) { should be_true }
194
+ its(:address) { should == 'member@example.com' }
195
+ its(:name) { should == 'Member Name' }
196
+ its(:subscribed) { should be_truthy }
192
197
 
193
- context 'vars' do
194
- subject { response.member.vars }
198
+ context 'vars' do
199
+ subject { response.member.vars }
195
200
 
196
- its(:awesome) { should be_true }
201
+ its(:awesome) { should be_truthy }
202
+ end
203
+ end
197
204
  end
198
- end
199
- end
200
205
 
201
- context '#create_member' do
202
- let(:params) do
203
- {
204
- address: 'member@example.com',
205
- name: 'Member Name',
206
- vars: { awesome: true },
207
- }
208
- end
206
+ context '#create_member' do
207
+ let(:params) do
208
+ {
209
+ address: 'member@example.com',
210
+ name: 'Member Name',
211
+ vars: { awesome: true },
212
+ }
213
+ end
209
214
 
210
- let(:response) do
211
- resource.create_member('newsletter@pewpew.mailgun.org', params)
212
- end
215
+ let(:response) do
216
+ resource.create_member('newsletter@pewpew.mailgun.org', params)
217
+ end
213
218
 
214
- subject { response }
219
+ subject { response }
215
220
 
216
- specify { should be_success }
221
+ specify { should be_success }
217
222
 
218
- its(:status) { should == 200 }
219
- its(:message) { should == 'Mailing list member has been created' }
223
+ its(:status) { should == 200 }
224
+ its(:message) { should == 'Mailing list member has been created' }
220
225
 
221
- context 'member' do
222
- subject { response.member }
226
+ context 'member' do
227
+ subject { response.member }
223
228
 
224
- its(:address) { should == 'member@example.com' }
225
- its(:name) { should == 'Member Name' }
226
- its(:subscribed) { should be_true }
229
+ its(:address) { should == 'member@example.com' }
230
+ its(:name) { should == 'Member Name' }
231
+ its(:subscribed) { should be_truthy }
227
232
 
228
- context 'vars' do
229
- subject { response.member.vars }
233
+ context 'vars' do
234
+ subject { response.member.vars }
230
235
 
231
- its(:awesome) { should be_true }
236
+ its(:awesome) { should be_truthy }
237
+ end
238
+ end
232
239
  end
233
- end
234
- end
235
240
 
236
- context '#update_member' do
237
- let(:params) { { subscribed: false } }
241
+ context '#update_member' do
242
+ let(:params) { { subscribed: false } }
238
243
 
239
- let(:response) do
240
- resource.update_member('newsletter@pewpew.mailgun.org', 'member@example.com', params)
241
- end
244
+ let(:response) do
245
+ resource.update_member(
246
+ 'newsletter@pewpew.mailgun.org',
247
+ 'member@example.com',
248
+ params,
249
+ )
250
+ end
242
251
 
243
- subject { response }
252
+ subject { response }
244
253
 
245
- specify { should be_success }
254
+ specify { should be_success }
246
255
 
247
- its(:status) { should == 200 }
248
- its(:message) { should == 'Mailing list member has been updated' }
256
+ its(:status) { should == 200 }
257
+ its(:message) { should == 'Mailing list member has been updated' }
249
258
 
250
- context 'member' do
251
- subject { response.member }
259
+ context 'member' do
260
+ subject { response.member }
252
261
 
253
- its(:address) { should == 'member@example.com' }
254
- its(:name) { should == 'Member Name' }
255
- its(:subscribed) { should be_false }
262
+ its(:address) { should == 'member@example.com' }
263
+ its(:name) { should == 'Member Name' }
264
+ its(:subscribed) { should be_falsey }
256
265
 
257
- context 'vars' do
258
- subject { response.member.vars }
266
+ context 'vars' do
267
+ subject { response.member.vars }
259
268
 
260
- its(:awesome) { should be_true }
269
+ its(:awesome) { should be_truthy }
270
+ end
271
+ end
261
272
  end
262
- end
263
- end
264
273
 
265
- context '#remove_member' do
266
- let(:response) do
267
- resource.remove_member('newsletter@pewpew.mailgun.org', 'member@example.com')
268
- end
274
+ context '#remove_member' do
275
+ let(:response) do
276
+ resource.remove_member(
277
+ 'newsletter@pewpew.mailgun.org',
278
+ 'member@example.com',
279
+ )
280
+ end
269
281
 
270
- subject { response }
282
+ subject { response }
271
283
 
272
- specify { should be_success }
284
+ specify { should be_success }
273
285
 
274
- its(:status) { should == 200 }
275
- its(:message) { should == 'Mailing list member has been deleted' }
286
+ its(:status) { should == 200 }
287
+ its(:message) { should == 'Mailing list member has been deleted' }
276
288
 
277
- context 'member' do
278
- subject { response.member }
289
+ context 'member' do
290
+ subject { response.member }
279
291
 
280
- its(:address) { should == 'member@example.com' }
292
+ its(:address) { should == 'member@example.com' }
293
+ end
294
+ end
281
295
  end
282
296
  end
283
297
  end
@@ -1,28 +1,33 @@
1
- # encoding: UTF-8
2
-
3
- require 'spec_helper'
4
-
5
- describe PewPew::Resources::Logs, :resource, :domain do
6
- let(:resource) { described_class.new(client) }
7
-
8
- context '#all' do
9
- let(:response) { resource.all }
10
-
11
- subject { response }
12
-
13
- specify { should be_success }
14
-
15
- its(:status) { should == 200 }
16
- its(:total_count) { should == 27 }
17
-
18
- context 'item' do
19
- subject { response.items.first }
20
-
21
- its(:created_at) { should == 'Fri, 01 Jun 2012 04:19:04 GMT' }
22
- its(:hap) { should == 'delivered' }
23
- its(:message) { should == "Delivered: postmaster@pewpew.mailgun.org → pewpew@devoh.com 'Test'" }
24
- its(:message_id) { should == '4fc84273c474_48dd3fe70cc34cd05949d@rouge.local.mail' }
25
- its(:type) { should == 'info' }
1
+ module PewPew
2
+ module Resources
3
+ RSpec.describe Logs, :resource, :domain do
4
+ let(:resource) { described_class.new(client) }
5
+
6
+ context '#all' do
7
+ let(:response) { resource.all }
8
+
9
+ subject { response }
10
+
11
+ specify { should be_success }
12
+
13
+ its(:status) { should == 200 }
14
+ its(:total_count) { should == 27 }
15
+
16
+ context 'item' do
17
+ subject { response.items.first }
18
+
19
+ its(:created_at) { should == 'Fri, 01 Jun 2012 04:19:04 GMT' }
20
+ its(:hap) { should == 'delivered' }
21
+ its(:message) {
22
+ should == 'Delivered: postmaster@pewpew.mailgun.org ' \
23
+ "→ pewpew@devoh.com 'Test'"
24
+ }
25
+ its(:message_id) {
26
+ should == '4fc84273c474_48dd3fe70cc34cd05949d@rouge.local.mail'
27
+ }
28
+ its(:type) { should == 'info' }
29
+ end
30
+ end
26
31
  end
27
32
  end
28
33
  end
@@ -1,59 +1,61 @@
1
- require 'spec_helper'
1
+ module PewPew
2
+ module Resources
3
+ RSpec.describe Mailboxes, :resource, :domain do
4
+ let(:resource) { described_class.new(client) }
2
5
 
3
- describe PewPew::Resources::Mailboxes, :resource, :domain do
4
- let(:resource) { described_class.new(client) }
6
+ context '#all' do
7
+ let(:response) { resource.all }
5
8
 
6
- context '#all' do
7
- let(:response) { resource.all }
9
+ subject { response }
8
10
 
9
- subject { response }
11
+ specify { should be_success }
10
12
 
11
- specify { should be_success }
13
+ its(:status) { should == 200 }
14
+ its(:total_count) { should == 1 }
12
15
 
13
- its(:status) { should == 200 }
14
- its(:total_count) { should == 1 }
16
+ context 'item' do
17
+ subject { response.items.first }
15
18
 
16
- context 'item' do
17
- subject { response.items.first }
19
+ its(:created_at) { should == 'Mon, 21 May 2012 22:12:54 GMT' }
20
+ its(:mailbox) { should == 'postmaster@pewpew.mailgun.org' }
21
+ its(:size_bytes) { should be_nil }
22
+ end
23
+ end
18
24
 
19
- its(:created_at) { should == 'Mon, 21 May 2012 22:12:54 GMT' }
20
- its(:mailbox) { should == 'postmaster@pewpew.mailgun.org' }
21
- its(:size_bytes) { should be_nil }
22
- end
23
- end
24
-
25
- context '#create' do
26
- let(:params) { { mailbox: 'test', password: 'secret' } }
27
- let(:response) { resource.create(params) }
25
+ context '#create' do
26
+ let(:params) { { mailbox: 'test', password: 'secret' } }
27
+ let(:response) { resource.create(params) }
28
28
 
29
- subject { response }
29
+ subject { response }
30
30
 
31
- specify { should be_success }
31
+ specify { should be_success }
32
32
 
33
- its(:status) { should == 200 }
34
- its(:message) { should == 'Created 1 mailboxes' }
35
- end
33
+ its(:status) { should == 200 }
34
+ its(:message) { should == 'Created 1 mailboxes' }
35
+ end
36
36
 
37
- context '#update' do
38
- let(:params) { { password: 's3cr3t' } }
39
- let(:response) { resource.update('test', params) }
37
+ context '#update' do
38
+ let(:params) { { password: 's3cr3t' } }
39
+ let(:response) { resource.update('test', params) }
40
40
 
41
- subject { response }
41
+ subject { response }
42
42
 
43
- specify { should be_success }
43
+ specify { should be_success }
44
44
 
45
- its(:status) { should == 200 }
46
- its(:message) { should == 'Password changed' }
47
- end
45
+ its(:status) { should == 200 }
46
+ its(:message) { should == 'Password changed' }
47
+ end
48
48
 
49
- context '#remove' do
50
- let(:response) { resource.remove('test') }
49
+ context '#remove' do
50
+ let(:response) { resource.remove('test') }
51
51
 
52
- subject { response }
52
+ subject { response }
53
53
 
54
- specify { should be_success }
54
+ specify { should be_success }
55
55
 
56
- its(:status) { should == 200 }
57
- its(:message) { should == 'Mailbox has been deleted' }
56
+ its(:status) { should == 200 }
57
+ its(:message) { should == 'Mailbox has been deleted' }
58
+ end
59
+ end
58
60
  end
59
61
  end