streamsend 0.2.3 → 1.0.0.rc1

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.
Files changed (97) hide show
  1. data/.gitignore +18 -5
  2. data/.rspec +1 -0
  3. data/Gemfile +2 -1
  4. data/Gemfile.lock +25 -17
  5. data/README.md +76 -0
  6. data/Rakefile +1 -2
  7. data/lib/streamsend/api/account.rb +6 -48
  8. data/lib/streamsend/api/audience.rb +14 -0
  9. data/lib/streamsend/api/base/base_call.rb +60 -0
  10. data/lib/streamsend/api/base/create.rb +41 -0
  11. data/lib/streamsend/api/base/destroy.rb +43 -0
  12. data/lib/streamsend/api/base/index.rb +51 -0
  13. data/lib/streamsend/api/base/show.rb +42 -0
  14. data/lib/streamsend/api/base/update.rb +43 -0
  15. data/lib/streamsend/api/blast.rb +51 -0
  16. data/lib/streamsend/api/bounce.rb +20 -0
  17. data/lib/streamsend/api/click.rb +18 -0
  18. data/lib/streamsend/api/configuration.rb +26 -0
  19. data/lib/streamsend/api/email.rb +20 -0
  20. data/lib/streamsend/api/exception.rb +4 -4
  21. data/lib/streamsend/api/field.rb +20 -0
  22. data/lib/streamsend/api/field_option.rb +60 -0
  23. data/lib/streamsend/api/filter.rb +20 -0
  24. data/lib/streamsend/api/from_email_address.rb +24 -0
  25. data/lib/streamsend/api/import.rb +11 -0
  26. data/lib/streamsend/api/link.rb +11 -0
  27. data/lib/streamsend/api/list.rb +13 -39
  28. data/lib/streamsend/api/membership.rb +28 -0
  29. data/lib/streamsend/api/person.rb +66 -0
  30. data/lib/streamsend/api/result.rb +13 -0
  31. data/lib/streamsend/api/session.rb +73 -0
  32. data/lib/streamsend/api/unsubscribe.rb +20 -0
  33. data/lib/streamsend/api/upload.rb +13 -0
  34. data/lib/streamsend/api/user.rb +67 -38
  35. data/lib/streamsend/api/view.rb +8 -0
  36. data/lib/streamsend/version.rb +3 -0
  37. data/lib/streamsend.rb +35 -16
  38. data/spec/lib/streamsend/api/integration/account_spec.rb +50 -0
  39. data/spec/lib/streamsend/api/integration/audience_spec.rb +56 -0
  40. data/spec/lib/streamsend/api/integration/blast_spec.rb +110 -0
  41. data/spec/lib/streamsend/api/integration/bounce_spec.rb +43 -0
  42. data/spec/lib/streamsend/api/integration/click_spec.rb +37 -0
  43. data/spec/lib/streamsend/api/integration/email_spec.rb +76 -0
  44. data/spec/lib/streamsend/api/integration/field_option_spec.rb +87 -0
  45. data/spec/lib/streamsend/api/integration/field_spec.rb +75 -0
  46. data/spec/lib/streamsend/api/integration/filter_spec.rb +101 -0
  47. data/spec/lib/streamsend/api/integration/from_email_address_spec.rb +46 -0
  48. data/spec/lib/streamsend/api/integration/helpers.rb +16 -0
  49. data/spec/lib/streamsend/api/integration/import_spec.rb +35 -0
  50. data/spec/lib/streamsend/api/integration/link_spec.rb +39 -0
  51. data/spec/lib/streamsend/api/integration/list_spec.rb +83 -0
  52. data/spec/lib/streamsend/api/integration/membership_spec.rb +69 -0
  53. data/spec/lib/streamsend/api/integration/person_spec.rb +119 -0
  54. data/spec/lib/streamsend/api/integration/unsubscribe_spec.rb +47 -0
  55. data/spec/lib/streamsend/api/integration/upload_spec.rb +29 -0
  56. data/spec/lib/streamsend/api/integration/user_spec.rb +99 -0
  57. data/spec/lib/streamsend/api/integration/view_spec.rb +27 -0
  58. data/spec/lib/streamsend/api/unit/base/base_call_spec.rb +66 -0
  59. data/spec/lib/streamsend/api/unit/base/create_spec.rb +67 -0
  60. data/spec/lib/streamsend/api/unit/base/destroy_spec.rb +59 -0
  61. data/spec/lib/streamsend/api/unit/base/index_spec.rb +85 -0
  62. data/spec/lib/streamsend/api/unit/base/show_spec.rb +68 -0
  63. data/spec/lib/streamsend/api/unit/base/update_spec.rb +76 -0
  64. data/spec/lib/streamsend/api/unit/blast_spec.rb +79 -0
  65. data/spec/lib/streamsend/api/unit/bounce_spec.rb +36 -0
  66. data/spec/lib/streamsend/api/unit/click_spec.rb +34 -0
  67. data/spec/lib/streamsend/api/unit/field_option_spec.rb +71 -0
  68. data/spec/lib/streamsend/api/unit/from_email_address_spec.rb +20 -0
  69. data/spec/lib/streamsend/api/unit/link_spec.rb +33 -0
  70. data/spec/lib/streamsend/api/unit/list_spec.rb +33 -0
  71. data/spec/lib/streamsend/api/unit/membership_spec.rb +46 -0
  72. data/spec/lib/streamsend/api/unit/person_spec.rb +102 -0
  73. data/spec/lib/streamsend/api/unit/result_spec.rb +13 -0
  74. data/spec/lib/streamsend/api/unit/session_spec.rb +62 -0
  75. data/spec/lib/streamsend/api/unit/unsubscribe_spec.rb +33 -0
  76. data/spec/lib/streamsend/api/unit/user_spec.rb +102 -0
  77. data/spec/spec_helper.rb +8 -11
  78. data/streamsend.gemspec +22 -23
  79. metadata +250 -178
  80. checksums.yaml +0 -7
  81. data/.pair +0 -10
  82. data/README.rdoc +0 -1
  83. data/lib/streamsend/api/resource.rb +0 -41
  84. data/lib/streamsend/api/subscriber.rb +0 -113
  85. data/spec/integration/account_spec.rb +0 -69
  86. data/spec/integration/fixtures/vcr_cassettes/streamsend.yml +0 -6831
  87. data/spec/integration/integration.yml +0 -5
  88. data/spec/integration/list_spec.rb +0 -68
  89. data/spec/integration/spec_helper.rb +0 -16
  90. data/spec/integration/subscriber_spec.rb +0 -24
  91. data/spec/integration/user_spec.rb +0 -58
  92. data/spec/lib/streamsend/api/list_spec.rb +0 -179
  93. data/spec/lib/streamsend/api/resource_spec.rb +0 -24
  94. data/spec/lib/streamsend/api/subscriber_spec.rb +0 -345
  95. data/spec/lib/streamsend/api/user_spec.rb +0 -149
  96. data/spec/lib/streamsend/api_spec.rb +0 -31
  97. data/watcher_config.rb +0 -2
@@ -1,345 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "../../../spec_helper")
2
- require "ostruct"
3
-
4
- module StreamSend
5
- module Api
6
- describe "Subscriber" do
7
- before do
8
- WebMock.enable!
9
- stub_http_request(:any, //).to_return(:body => "Page not found.", :status => 404)
10
-
11
- @username = "scott"
12
- @password = "topsecret"
13
- @host = "test.host"
14
-
15
- xml = <<-XML
16
- <?xml version="1.0" encoding="UTF-8"?>
17
- <audiences type="array">
18
- <audience>
19
- <id type="integer">2</id>
20
- </audience>
21
- </audiences>
22
- XML
23
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/audiences.xml").to_return(:body => xml)
24
-
25
- StreamSend::Api.configure(@username, @password, @host)
26
- end
27
-
28
- after do
29
- WebMock.disable!
30
- end
31
-
32
- describe ".audience_id" do
33
- it "should return the id of the first audience" do
34
- StreamSend::Api::Subscriber.audience_id.should == 2
35
- end
36
-
37
- it "should throw an error on failure" do
38
- xml = <<-XML
39
- <?xml version="1.0" encoding="UTF-8"?>
40
- <foo></foo>
41
- XML
42
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/audiences.xml").to_return(:body => xml)
43
- expect { StreamSend::Api::Subscriber.audience_id.should == 2 }.to raise_error(StreamSend::Api::Exception)
44
- end
45
- end
46
-
47
- describe ".clear_audience" do
48
- it "allows the audience_id to be retrieved again" do
49
- @resource = StreamSend::Api::Resource.new({"name" => "jeff"})
50
- StreamSend::Api.should_receive(:get).with("/audiences.xml").and_return(OpenStruct.new(:parsed_response => { "audiences" => [{"id" => 2}] }))
51
- StreamSend::Api::Resource.audience_id.should == 2
52
- StreamSend::Api.should_receive(:get).with("/audiences.xml").and_return(OpenStruct.new(:parsed_response => { "audiences" => [{"id" => 1}] }))
53
- StreamSend::Api::Resource.audience_id.should == 2
54
- StreamSend::Api::Resource.clear_audience
55
- StreamSend::Api::Resource.audience_id.should == 1
56
- end
57
- end
58
-
59
- describe ".index" do
60
- describe "with subscribers" do
61
- before(:each) do
62
- xml = <<-XML
63
- <?xml version="1.0" encoding="UTF-8"?>
64
- <people type="array">
65
- <person>
66
- <id type="integer">2</id>
67
- <email-address>scott@gmail.com</email-address>
68
- <created-at type="datetime">2009-09-18T01:27:05Z</created-at>
69
- </person>
70
- </people>
71
- XML
72
-
73
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/audiences/2/people.xml?").to_return(:body => xml)
74
- end
75
-
76
- it "should return array of one subscriber object" do
77
- subscribers = StreamSend::Api::Subscriber.index
78
- subscribers.size.should == 1
79
-
80
- subscribers.first.should be_instance_of(StreamSend::Api::Subscriber)
81
- subscribers.first.id.should == 2
82
- subscribers.first.email_address.should == "scott@gmail.com"
83
- subscribers.first.created_at.should == Time.parse("2009-09-18T01:27:05Z")
84
- end
85
- end
86
-
87
- describe "with no subscribers" do
88
- before(:each) do
89
- xml = <<-XML
90
- <?xml version="1.0" encoding="UTF-8"?>
91
- <people type="array"/>
92
- XML
93
-
94
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/audiences/2/people.xml?").to_return(:body => xml)
95
- end
96
-
97
- it "should return an empty array" do
98
- StreamSend::Api::Subscriber.index.should == []
99
- end
100
- end
101
-
102
- describe "with invalid audience" do
103
- before(:each) do
104
- xml = <<-XML
105
- <?xml version="1.0" encoding="UTF-8"?>
106
- <people type="array"/>
107
- XML
108
-
109
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/audiences/99/people.xml").to_return(:body => xml)
110
- end
111
-
112
- it "should raise an exception" do
113
- expect do
114
- StreamSend::Api::Subscriber.index
115
- end.to raise_error(ApiException)
116
- end
117
- end
118
- end
119
-
120
- describe ".find" do
121
- describe "with matching subscriber" do
122
- before(:each) do
123
- xml = <<-XML
124
- <?xml version="1.0" encoding="UTF-8"?>
125
- <people type="array">
126
- <person>
127
- <id type="integer">2</id>
128
- <email-address>scott@gmail.com</email-address>
129
- <created-at type="datetime">2009-09-18T01:27:05Z</created-at>
130
- </person>
131
- </people>
132
- XML
133
-
134
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/audiences/2/people.xml?email_address=scott@gmail.com").to_return(:body => xml)
135
- end
136
-
137
- it "should return subscriber" do
138
- subscriber = StreamSend::Api::Subscriber.find("scott@gmail.com")
139
-
140
- subscriber.should be_instance_of(StreamSend::Api::Subscriber)
141
- subscriber.id.should == 2
142
- subscriber.email_address.should == "scott@gmail.com"
143
- subscriber.created_at.should == Time.parse("2009-09-18T01:27:05Z")
144
- end
145
- end
146
-
147
- describe "with invalid audience" do
148
- before(:each) do
149
- xml = <<-XML
150
- <?xml version="1.0" encoding="UTF-8"?>
151
- <people type="array"\>
152
- XML
153
-
154
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/audiences/99/people.xml?email_address=bad.email@gmail.com").to_return(:body => xml)
155
- end
156
-
157
- it "should raise an exception" do
158
- lambda { StreamSend::Api::Subscriber.find("scott@gmail.com") }.should raise_error
159
- end
160
- end
161
- end
162
-
163
- describe ".create" do
164
- describe "with valid subscriber parameters" do
165
- describe "with no existing subscribers using the given email address" do
166
- before(:each) do
167
- stub_http_request(:post, /audiences\/2\/people.xml/).with(:person => {"email_address" => "foo@bar.com", "first_name" => "JoeBob"}).to_return(:body => "", :headers => {"location" => "http://test.host/audiences/2/people/1"}, :status => 201)
168
- end
169
-
170
- it "should return the new subscriber's id" do
171
- subscriber_id = StreamSend::Api::Subscriber.create({"email_address" => "foo@bar.com", "first_name" => "JoeBob"})
172
-
173
- subscriber_id.should_not be_nil
174
- subscriber_id.should == 1
175
- end
176
- end
177
-
178
- describe "when receiving a semantic error" do
179
- describe "with a single error" do
180
- let( :error1 ){ "Email address has already been taken" }
181
-
182
- before(:each) do
183
- response_body = <<-XML
184
- <errors>
185
- <error>#{error1}</error>
186
- </errors>
187
- XML
188
- stub_http_request(:post, /audiences\/2\/people.xml/).with(:person => {"email_address" => "foo@bar.com", "first_name" => "JoeBob"}).to_return(:status => 422, :body => response_body )
189
- end
190
-
191
- it "should raise an exception" do
192
- expect do
193
- subscriber_id = StreamSend::Api::Subscriber.create({"email_address" => "foo@bar.com", "first_name" => "JoeBob"})
194
- end.to raise_error( StreamSend::Api::SemanticException )
195
- end
196
-
197
- it "should pass on the errors" do
198
- captured_problem = nil
199
- begin
200
- subscriber_id = StreamSend::Api::Subscriber.create({"email_address" => "foo@bar.com", "first_name" => "JoeBob"})
201
- rescue StreamSend::Api::SemanticException => problem
202
- captured_problem = problem
203
- end
204
- expect(captured_problem.errors.count).to be(1)
205
- expect(captured_problem.errors).to include(error1)
206
- end
207
- end
208
- end
209
-
210
- describe "with multiple errors" do
211
- let( :error1 ){ "bonjour" }
212
- let( :error2 ){ "some other string you are unlikely to copy and paste" }
213
-
214
- before(:each) do
215
- response_body = <<-XML
216
- <errors>
217
- <error>#{error1}</error>
218
- <error>#{error2}</error>
219
- </errors>
220
- XML
221
- stub_http_request(:post, /audiences\/2\/people.xml/).with(:person => {"email_address" => "foo@bar.com", "first_name" => "JoeBob"}).to_return(:status => 422, :body => response_body )
222
- end
223
-
224
- it "should pass on the errors" do
225
- captured_problem = nil
226
- begin
227
- subscriber_id = StreamSend::Api::Subscriber.create({"email_address" => "foo@bar.com", "first_name" => "JoeBob"})
228
- rescue StreamSend::Api::SemanticException => problem
229
- captured_problem = problem
230
- end
231
- expect(captured_problem.errors.count).to eq( 2 )
232
- expect(captured_problem.errors).to include(error1, error2)
233
- end
234
- end
235
- end
236
- end
237
-
238
- describe "#show" do
239
- describe "with valid subscriber instance" do
240
- before(:each) do
241
- xml = <<-XML
242
- <?xml version="1.0" encoding="UTF-8"?>
243
- <person>
244
- <id type="integer">2</id>
245
- <email-address>scott@gmail.com</email-address>
246
- <created-at type="datetime">2009-09-18T01:27:05Z</created-at>
247
- <first-name>Scott</first-name>
248
- <last-name>Albertson</last-name>
249
- </person>
250
- XML
251
-
252
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/audiences/1/people/2.xml").to_return(:body => xml)
253
- end
254
-
255
- it "should return subscriber" do
256
- subscriber = StreamSend::Api::Subscriber.new({"id" => 2, "audience_id" => 1}).show
257
-
258
- subscriber.should be_instance_of(StreamSend::Api::Subscriber)
259
- subscriber.id.should == 2
260
- subscriber.email_address.should == "scott@gmail.com"
261
- subscriber.created_at.should == Time.parse("2009-09-18T01:27:05Z")
262
- subscriber.first_name.should == "Scott"
263
- subscriber.last_name.should == "Albertson"
264
- end
265
- end
266
-
267
- describe "with invalid subscriber instance" do
268
- it "should raise exception" do
269
- lambda { StreamSend::Api::Subscriber.new({"id" => 99, "audience_id" => 1}).show }.should raise_error
270
- end
271
- end
272
-
273
- describe "with invalid audience" do
274
- it "should raise exception" do
275
- lambda { StreamSend::Api::Subscriber.new({"id" => 2}).show }.should raise_error
276
- end
277
- end
278
- end
279
-
280
- describe "#activate" do
281
- before(:each) do
282
- stub_http_request(:post, "http://#{@username}:#{@password}@#{@host}/audiences/1/people/2/activate.xml").to_return(:body => nil)
283
- end
284
-
285
- describe "with valid subscriber" do
286
- it "should be successful" do
287
- response = StreamSend::Api::Subscriber.new({"id" => 2, "audience_id" => 1}).activate
288
- response.should be_true
289
- end
290
- end
291
-
292
- describe "with invalid subscriber" do
293
- it "should raise exception" do
294
- lambda { StreamSend::Api::Subscriber.new({"id" => 99, "audience_id" => 1}).activate }.should raise_error
295
- end
296
- end
297
- end
298
-
299
- describe "#unsubscribe" do
300
- before(:each) do
301
- stub_http_request(:post, "http://#{@username}:#{@password}@#{@host}/audiences/1/people/2/unsubscribe.xml").to_return(:body => nil)
302
- end
303
-
304
- describe "with valid subscriber" do
305
- it "should be successful" do
306
- response = StreamSend::Api::Subscriber.new({"id" => 2, "audience_id" => 1}).unsubscribe
307
- response.should be_true
308
- end
309
- end
310
-
311
- describe "with invalid subscriber" do
312
- it "should raise exception" do
313
- lambda { StreamSend::Api::Subscriber.new({"id" => 99, "audience_id" => 1}).unsubscribe }.should raise_error
314
- end
315
- end
316
- end
317
-
318
- describe "#destroy" do
319
- let( :subscriber ){
320
- StreamSend::Api::Subscriber.new({"id"=> 2, "audience_id" => 1})
321
- }
322
- let( :uri ){ "http://#{@username}:#{@password}@#{@host}/audiences/1/people/2.xml" }
323
-
324
- it "returns true when destroyed" do
325
- stub_http_request(:delete, uri ).to_return(:body => nil)
326
- expect(subscriber.destroy).to be_true
327
- end
328
-
329
- it "throws a LockedError when locked" do
330
- stub_http_request(:delete, uri ).to_return(:status => 423, :body => nil)
331
- expect do
332
- subscriber.destroy
333
- end.to raise_error( LockedError )
334
- end
335
-
336
- it "throws unexpected response with any other exception" do
337
- stub_http_request(:delete, uri ).to_return(:status => 500, :body => "Error text meant for HCI")
338
- expect do
339
- subscriber.destroy
340
- end.to raise_error( UnexpectedResponse )
341
- end
342
- end
343
- end
344
- end
345
- end
@@ -1,149 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "../../../spec_helper")
2
- require "webmock"
3
- require "active_support/core_ext/hash"
4
-
5
- module StreamSend
6
- module Api
7
- describe "User" do
8
- let(:app_host) { "http://test.host" }
9
-
10
- before do
11
- WebMock.enable!
12
- @username = "jeff"
13
- @password = "topsecret"
14
- @host = "test.host"
15
- StreamSend::Api.configure(@username, @password, @host)
16
- end
17
-
18
- after do
19
- WebMock.disable!
20
- end
21
-
22
- describe "#all" do
23
- describe "with two users" do
24
- before do
25
- users = <<-XML
26
- <?xml version="1.0" encoding="UTF-8"?>
27
- <users type="array">
28
- <user>
29
- <administrator type="boolean">true</administrator>
30
- <title>Administrator</title>
31
- <last-name>User</last-name>
32
- <updated-at type="datetime">2012-11-29T17:14:55-08:00</updated-at>
33
- <may-export type="boolean">true</may-export>
34
- <id type="integer">1</id>
35
- <email-address>admin@streamsend.com</email-address>
36
- <first-name>Admin</first-name>
37
- <company-name>Not Random BS</company-name>
38
- <created-at type="datetime">2012-11-29T17:14:55-08:00</created-at>
39
- </user>
40
-
41
- <user>
42
- <administrator type="boolean">false</administrator>
43
- <title>regular user</title>
44
- <last-name>User2</last-name>
45
- <updated-at type="datetime">2012-11-29T17:14:55-08:00</updated-at>
46
- <may-export type="boolean">true</may-export>
47
- <id type="integer">1</id>
48
- <email-address>joe@streamsend.com</email-address>
49
- <first-name>Joe</first-name>
50
- <company-name>Not Random BS</company-name>
51
- <created-at type="datetime">2012-11-29T17:14:55-08:00</created-at>
52
- </user>
53
- </users>
54
- XML
55
-
56
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/users.xml").to_return(:body => users)
57
- end
58
-
59
- it "should return an array of two users" do
60
- users = StreamSend::Api::User.all
61
- users.size.should == 2
62
- end
63
-
64
- it "should return an array with the two users" do
65
- users = StreamSend::Api::User.all
66
- users.first.id.should == 1
67
- end
68
- end
69
-
70
- describe "with no users" do
71
- before do
72
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/users.xml").to_return(:body => "Page not found.", :status => 404)
73
- end
74
-
75
- it "should raise an error" do
76
- lambda do
77
- users = StreamSend::Api::User.all
78
- end.should raise_error
79
- end
80
-
81
- end
82
- end
83
-
84
- describe "#show" do
85
- describe "with a single user" do
86
- before do
87
- xml = <<-XML
88
- <?xml version="1.0" encoding="UTF-8"?>
89
- <user>
90
- <id>2</id>
91
- <email-address>john2@example.com</email-address>
92
- <first-name>John2</first-name>
93
- <last-name>Doe</last-name>
94
- </user>
95
- XML
96
- stub_http_request(:get, "http://#{@username}:#{@password}@#{@host}/users/2.xml").to_return(:body => xml)
97
- end
98
-
99
- it "returns the user" do
100
- user = StreamSend::Api::User.show(2)
101
- user.id.should == "2"
102
- user.first_name.should == "John2"
103
- end
104
- end
105
-
106
- describe "with an invalid user" do
107
- before do
108
- stub_http_request(:post, "http://#{@username}:#{@password}@#{@host}/users/2.xml").to_return(:body => "Page not found.")
109
- end
110
-
111
- it "should raise an error" do
112
- lambda do
113
- user = StreamSend::Api::User.show(30)
114
- end.should raise_error
115
- end
116
- end
117
- end
118
-
119
- describe ".create" do
120
- describe "with valid user parameters" do
121
- describe "with an existing users" do
122
- before(:each) do
123
- stub_http_request(:post, /accounts\/1\/users.xml/).with(:person => {"email_address" => "foo@bar.com", "first_name" => "JoeBob"}).to_return(:body => "", :headers => {"location" => "http://test.host/accounts/2/users/1"}, :status => 201)
124
- end
125
-
126
- it "should return the new user's id" do
127
- user_id = StreamSend::Api::User.create({"account_id" => 1, "email_address" => "foo@bar.com", "first_name" => "JoeBob"})
128
-
129
- user_id.should_not be_nil
130
- user_id.should == 1
131
- end
132
- end
133
- end
134
-
135
- describe "with invalid user parameters" do
136
- before(:each) do
137
- stub_http_request(:post, "/account/1/users.xml").with(:person => {"email_address" => "foo@bar.com", "first_name" => "JoeBob"}).to_return(:status => 422)
138
- end
139
-
140
- it "should raise an error" do
141
- lambda do
142
- user_id = StreamSend::Api::User.create({"account_id" => 1, "email_address" => "foo@bar.com", "first_name" => "JoeBob"})
143
- end.should raise_error
144
- end
145
- end
146
- end
147
- end
148
- end
149
- end
@@ -1,31 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe StreamSend::Api do
4
- describe ".configure" do
5
- let( :test_host ) { "http://host.example.com" }
6
- let( :test_user ) { "John+Carter@example.com" }
7
- let( :test_password ) { "this-is-a-really-secure-password" }
8
-
9
- it "should set username" do
10
- StreamSend::Api.configure( test_user, test_password )
11
- StreamSend::Api.default_options[:basic_auth][:username].should == test_user
12
- end
13
-
14
- it "should set password" do
15
- StreamSend::Api.configure( test_user, test_password )
16
- StreamSend::Api.default_options[:basic_auth][:password].should == test_password
17
- end
18
-
19
- context "host" do
20
- it "sets the host when specified" do
21
- StreamSend::Api.configure( test_user, test_password, test_host )
22
- StreamSend::Api.base_uri.should == test_host
23
- end
24
-
25
- it "uses the default host when not specified" do
26
- StreamSend::Api.configure( test_user, test_password )
27
- StreamSend::Api.base_uri.should == "http://app.streamsend.com"
28
- end
29
- end
30
- end
31
- end
data/watcher_config.rb DELETED
@@ -1,2 +0,0 @@
1
- watch("spec/(.*)\.rb") { |md| system("rspec #{md[0]}") }
2
- watch("lib/(.*)\.rb") { |md| system("rspec spec/") }