zencoder-flix_cloud-gem 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 5
4
- :patch: 0
4
+ :patch: 1
@@ -1,5 +1,5 @@
1
1
  class FlixCloud::Error < StandardError; end
2
2
  class FlixCloud::SaveError < FlixCloud::Error; end
3
3
  class FlixCloud::CreateError < FlixCloud::Error; end
4
- class FlixCloud::Unauthorized < FlixCloud::Error; end
5
- class FlixCloud::RequestFailed < FlixCloud::Error; end
4
+ class FlixCloud::ServerBrokeConnection < FlixCloud::Error; end
5
+ class FlixCloud::RequestTimeout < FlixCloud::Error; end
@@ -37,7 +37,7 @@ protected
37
37
  rescue RestClient::ServerBrokeConnection
38
38
  raise FlixCloud::ServerBrokeConnection
39
39
  rescue RestClient::RequestTimeout
40
- raise FlixCloud::RequestFailed
40
+ raise FlixCloud::RequestTimeout
41
41
  end
42
42
  end
43
43
 
@@ -363,6 +363,7 @@ class FlixCloud::JobTest < Test::Unit::TestCase
363
363
  end
364
364
  end
365
365
 
366
+
366
367
  context "When creating an invalid job" do
367
368
  setup do
368
369
  @job = FlixCloud::Job.create
@@ -377,6 +378,7 @@ class FlixCloud::JobTest < Test::Unit::TestCase
377
378
  end
378
379
  end
379
380
 
381
+
380
382
  context "When creating a valid job" do
381
383
  setup do
382
384
  FakeWeb.allow_net_connect = false
@@ -413,6 +415,7 @@ class FlixCloud::JobTest < Test::Unit::TestCase
413
415
  end
414
416
  end
415
417
 
418
+
416
419
  context "When using create! to create an invalid job" do
417
420
  should "raise a FlixCloud::CreationError exception" do
418
421
  assert_raises FlixCloud::CreateError do
@@ -421,6 +424,7 @@ class FlixCloud::JobTest < Test::Unit::TestCase
421
424
  end
422
425
  end
423
426
 
427
+
424
428
  context "When using create! to create a valid job" do
425
429
  setup do
426
430
  FakeWeb.allow_net_connect = false
@@ -452,4 +456,52 @@ class FlixCloud::JobTest < Test::Unit::TestCase
452
456
  assert_not_nil @job.id
453
457
  end
454
458
  end
459
+
460
+
461
+ context "When calling save on a valid job and the server connection gets interrupted" do
462
+ setup do
463
+ RestClient::Resource.expects(:new).raises(RestClient::ServerBrokeConnection)
464
+ @job = FlixCloud::Job.new(:api_key => 'your-api-key',
465
+ :recipe_id => 2,
466
+ :input_url => 'your-input-url',
467
+ :input_user => 'your-input-user',
468
+ :input_password => 'your-input-password',
469
+ :output_url => 'your-output-url',
470
+ :output_user => 'your-output-user',
471
+ :output_password => 'your-output-password',
472
+ :watermark_url => 'your-watermark-url',
473
+ :watermark_user => 'your-watermark-user',
474
+ :watermark_password => 'your-watermark-password')
475
+ end
476
+
477
+ should "railse a FlixCloud::ServerBrokeConnection exception" do
478
+ assert_raises FlixCloud::ServerBrokeConnection do
479
+ @job.save
480
+ end
481
+ end
482
+ end
483
+
484
+ context "When calling save on a valid job and the connection times out" do
485
+ setup do
486
+ RestClient::Resource.expects(:new).raises(RestClient::RequestTimeout)
487
+ @job = FlixCloud::Job.new(:api_key => 'your-api-key',
488
+ :recipe_id => 2,
489
+ :input_url => 'your-input-url',
490
+ :input_user => 'your-input-user',
491
+ :input_password => 'your-input-password',
492
+ :output_url => 'your-output-url',
493
+ :output_user => 'your-output-user',
494
+ :output_password => 'your-output-password',
495
+ :watermark_url => 'your-watermark-url',
496
+ :watermark_user => 'your-watermark-user',
497
+ :watermark_password => 'your-watermark-password')
498
+ end
499
+
500
+ should "railse a FlixCloud::ServerBrokeConnection exception" do
501
+ assert_raises FlixCloud::RequestTimeout do
502
+ @job.save
503
+ end
504
+ end
505
+ end
506
+
455
507
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zencoder-flix_cloud-gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Sutton