active_encode 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -0
- data/active_encode.gemspec +1 -2
- data/lib/active_encode/engine_adapters/pass_through_adapter.rb +28 -7
- data/lib/active_encode/version.rb +1 -1
- metadata +4 -274
- data/spec/controllers/encode_record_controller_spec.rb +0 -53
- data/spec/fixtures//"file_with_double_quote/".low.mp4 +0 -0
- data/spec/fixtures//"file_with_double_quote/".mp4 +0 -0
- data/spec/fixtures/'file_with_single_quote'.low.mp4 +0 -0
- data/spec/fixtures/'file_with_single_quote'.mp4 +0 -0
- data/spec/fixtures/@/341/213/210/341/213/263/341/214/205/341/210/205 /341/210/233/341/210/255 /341/211/242. /341/210/206/341/212/225 /341/214/250/341/210/255/341/210/265. /341/210/205 /341/212/240/341/211/265/341/210/213/341/210/260!@#$^^&$%&.low.mov +0 -0
- data/spec/fixtures/@/341/213/210/341/213/263/341/214/205/341/210/205 /341/210/233/341/210/255 /341/211/242. /341/210/206/341/212/225 /341/214/250/341/210/255/341/210/265. /341/210/205 /341/212/240/341/211/265/341/210/213/341/210/260!@#$^^&$%&.mov +0 -0
- data/spec/fixtures/Bars_512kb.mp4 +0 -0
- data/spec/fixtures/elastic_transcoder/input_completed.json +0 -1
- data/spec/fixtures/elastic_transcoder/input_generic.json +0 -1
- data/spec/fixtures/elastic_transcoder/input_progressing.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_canceled.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_completed.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_created.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_failed.json +0 -1
- data/spec/fixtures/elastic_transcoder/job_progressing.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_canceled.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_completed.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_failed.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_progressing.json +0 -1
- data/spec/fixtures/elastic_transcoder/output_submitted.json +0 -1
- data/spec/fixtures/ffmpeg/cancelled-id/cancelled +0 -0
- data/spec/fixtures/ffmpeg/cancelled-id/error.log +0 -0
- data/spec/fixtures/ffmpeg/cancelled-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/cancelled-id/input_metadata +0 -90
- data/spec/fixtures/ffmpeg/cancelled-id/pid +0 -1
- data/spec/fixtures/ffmpeg/cancelled-id/progress +0 -11
- data/spec/fixtures/ffmpeg/completed-id/error.log +0 -0
- data/spec/fixtures/ffmpeg/completed-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/completed-id/input_metadata +0 -102
- data/spec/fixtures/ffmpeg/completed-id/output_metadata-high +0 -90
- data/spec/fixtures/ffmpeg/completed-id/output_metadata-low +0 -90
- data/spec/fixtures/ffmpeg/completed-id/pid +0 -1
- data/spec/fixtures/ffmpeg/completed-id/progress +0 -11
- data/spec/fixtures/ffmpeg/completed-id/video-high.mp4 +0 -0
- data/spec/fixtures/ffmpeg/completed-id/video-low.mp4 +0 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/error.log +0 -3
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/input_metadata +0 -102
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/output_metadata-high +0 -90
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/output_metadata-low +0 -90
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/pid +0 -1
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/progress +0 -11
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/video-high.mp4 +0 -0
- data/spec/fixtures/ffmpeg/completed-with-warnings-id/video-low.mp4 +0 -0
- data/spec/fixtures/ffmpeg/failed-id/error.log +0 -1
- data/spec/fixtures/ffmpeg/failed-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/failed-id/input_metadata +0 -90
- data/spec/fixtures/ffmpeg/failed-id/pid +0 -1
- data/spec/fixtures/ffmpeg/failed-id/progress +0 -11
- data/spec/fixtures/ffmpeg/incomplete-id/error.log +0 -0
- data/spec/fixtures/ffmpeg/incomplete-id/exit_status.code +0 -1
- data/spec/fixtures/ffmpeg/incomplete-id/input_metadata +0 -102
- data/spec/fixtures/ffmpeg/incomplete-id/output_metadata-high +0 -90
- data/spec/fixtures/ffmpeg/incomplete-id/output_metadata-low +0 -90
- data/spec/fixtures/ffmpeg/incomplete-id/pid +0 -1
- data/spec/fixtures/ffmpeg/incomplete-id/progress +0 -11
- data/spec/fixtures/ffmpeg/incomplete-id/video-high.mp4 +0 -0
- data/spec/fixtures/ffmpeg/incomplete-id/video-low.mp4 +0 -0
- data/spec/fixtures/ffmpeg/running-id/error.log +0 -0
- data/spec/fixtures/ffmpeg/running-id/input_metadata +0 -90
- data/spec/fixtures/ffmpeg/running-id/pid +0 -1
- data/spec/fixtures/ffmpeg/running-id/progress +0 -11
- data/spec/fixtures/file with space.low.mp4 +0 -0
- data/spec/fixtures/file with space.mp4 +0 -0
- data/spec/fixtures/file.with :=+%sp3c!l-ch4cts().mp4 +0 -0
- data/spec/fixtures/file.with...periods.mp4 +0 -0
- data/spec/fixtures/file_without_metadata.low.webm +0 -0
- data/spec/fixtures/file_without_metadata.mp4 +0 -0
- data/spec/fixtures/file_without_metadata.webm +0 -0
- data/spec/fixtures/fireworks.low.mp4 +0 -0
- data/spec/fixtures/fireworks.mp4 +0 -0
- data/spec/fixtures/matterhorn/cancelled_response.xml +0 -323
- data/spec/fixtures/matterhorn/completed_response.xml +0 -4
- data/spec/fixtures/matterhorn/create_response.xml +0 -300
- data/spec/fixtures/matterhorn/delete_track_response.xml +0 -2
- data/spec/fixtures/matterhorn/failed_response.xml +0 -4
- data/spec/fixtures/matterhorn/purged_response.xml +0 -342
- data/spec/fixtures/matterhorn/running_response.xml +0 -1
- data/spec/fixtures/matterhorn/stop_completed_response.xml +0 -228
- data/spec/fixtures/matterhorn/stop_running_response.xml +0 -339
- data/spec/fixtures/media_convert/endpoints.json +0 -1
- data/spec/fixtures/media_convert/job_canceled.json +0 -412
- data/spec/fixtures/media_convert/job_canceling.json +0 -1
- data/spec/fixtures/media_convert/job_completed.json +0 -359
- data/spec/fixtures/media_convert/job_completed_detail.json +0 -1
- data/spec/fixtures/media_convert/job_completed_detail_query.json +0 -1
- data/spec/fixtures/media_convert/job_completed_empty_detail.json +0 -1
- data/spec/fixtures/media_convert/job_created.json +0 -408
- data/spec/fixtures/media_convert/job_failed.json +0 -406
- data/spec/fixtures/media_convert/job_progressing.json +0 -414
- data/spec/fixtures/pass_through/cancelled-id/cancelled +0 -0
- data/spec/fixtures/pass_through/cancelled-id/input_metadata +0 -90
- data/spec/fixtures/pass_through/completed-id/completed +0 -0
- data/spec/fixtures/pass_through/completed-id/input_metadata +0 -102
- data/spec/fixtures/pass_through/completed-id/output_metadata-high +0 -90
- data/spec/fixtures/pass_through/completed-id/output_metadata-low +0 -90
- data/spec/fixtures/pass_through/completed-id/video-high.mp4 +0 -0
- data/spec/fixtures/pass_through/completed-id/video-low.mp4 +0 -0
- data/spec/fixtures/pass_through/failed-id/error.log +0 -1
- data/spec/fixtures/pass_through/failed-id/input_metadata +0 -90
- data/spec/fixtures/pass_through/running-id/input_metadata +0 -90
- data/spec/fixtures/zencoder/job_create.json +0 -1
- data/spec/fixtures/zencoder/job_details_cancelled.json +0 -1
- data/spec/fixtures/zencoder/job_details_completed.json +0 -1
- data/spec/fixtures/zencoder/job_details_create.json +0 -1
- data/spec/fixtures/zencoder/job_details_failed.json +0 -73
- data/spec/fixtures/zencoder/job_details_running.json +0 -1
- data/spec/fixtures/zencoder/job_progress_cancelled.json +0 -13
- data/spec/fixtures/zencoder/job_progress_completed.json +0 -13
- data/spec/fixtures/zencoder/job_progress_create.json +0 -1
- data/spec/fixtures/zencoder/job_progress_failed.json +0 -13
- data/spec/fixtures/zencoder/job_progress_running.json +0 -1
- data/spec/integration/elastic_transcoder_adapter_spec.rb +0 -218
- data/spec/integration/ffmpeg_adapter_spec.rb +0 -535
- data/spec/integration/matterhorn_adapter_spec.rb +0 -130
- data/spec/integration/media_convert_adapter_spec.rb +0 -321
- data/spec/integration/pass_through_adapter_spec.rb +0 -293
- data/spec/integration/zencoder_adapter_spec.rb +0 -391
- data/spec/rails_helper.rb +0 -25
- data/spec/routing/encode_record_controller_routing_spec.rb +0 -10
- data/spec/spec_helper.rb +0 -20
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -16
- data/spec/units/callbacks_spec.rb +0 -66
- data/spec/units/core_spec.rb +0 -160
- data/spec/units/engine_adapter_spec.rb +0 -67
- data/spec/units/file_locator_spec.rb +0 -129
- data/spec/units/filename_sanitizer_spec.rb +0 -20
- data/spec/units/global_id_spec.rb +0 -50
- data/spec/units/input_spec.rb +0 -40
- data/spec/units/output_spec.rb +0 -42
- data/spec/units/persistence_spec.rb +0 -61
- data/spec/units/polling_job_spec.rb +0 -87
- data/spec/units/polling_spec.rb +0 -23
- data/spec/units/status_spec.rb +0 -81
@@ -1,391 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'zencoder'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
describe ActiveEncode::EngineAdapters::ZencoderAdapter do
|
7
|
-
before(:all) do
|
8
|
-
ActiveEncode::Base.engine_adapter = :zencoder
|
9
|
-
end
|
10
|
-
after(:all) do
|
11
|
-
ActiveEncode::Base.engine_adapter = :test
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:create_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_create.json'))) }
|
15
|
-
|
16
|
-
before do
|
17
|
-
allow(Zencoder::Job).to receive(:create).and_return(create_response)
|
18
|
-
end
|
19
|
-
|
20
|
-
let(:file) { "file://#{File.absolute_path('spec/fixtures/Bars_512kb.mp4')}" }
|
21
|
-
|
22
|
-
describe "#create" do
|
23
|
-
subject { ActiveEncode::Base.create(file) }
|
24
|
-
before do
|
25
|
-
allow(Zencoder::Job).to receive(:details).and_return(details_response)
|
26
|
-
allow(Zencoder::Job).to receive(:progress).and_return(progress_response)
|
27
|
-
end
|
28
|
-
|
29
|
-
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_create.json'))) }
|
30
|
-
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_create.json'))) }
|
31
|
-
let(:create_output) { [{ id: "511404522", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150610/c09b61e4d130ddf923f0653418a80b9c/399ae101c3f99b4f318635e78a4e587a.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=GY/9LMkQAiDOrMQwS5BkmOE200s%3D&Expires=1434033527", label: nil }] }
|
32
|
-
|
33
|
-
it { is_expected.to be_a ActiveEncode::Base }
|
34
|
-
it { expect(subject.id).not_to be_empty }
|
35
|
-
it { is_expected.to be_running }
|
36
|
-
# it { expect(subject.output).to eq create_output }
|
37
|
-
it { expect(subject.current_operations).to be_empty }
|
38
|
-
it { expect(subject.percent_complete).to eq 0 }
|
39
|
-
it { expect(subject.errors).to be_empty }
|
40
|
-
it { expect(subject.created_at).to eq '2015-06-10T14:38:47Z' }
|
41
|
-
it { expect(subject.updated_at).to eq '2015-06-10T14:38:47Z' }
|
42
|
-
|
43
|
-
context 'input' do
|
44
|
-
subject { ActiveEncode::Base.create(file).input }
|
45
|
-
|
46
|
-
it { is_expected.to be_a ActiveEncode::Input }
|
47
|
-
it { expect(subject.id).to eq "166179248" }
|
48
|
-
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
49
|
-
it { expect(subject.width).to be_blank }
|
50
|
-
it { expect(subject.height).to be_blank }
|
51
|
-
it { expect(subject.frame_rate).to be_blank }
|
52
|
-
it { expect(subject.duration).to be_blank }
|
53
|
-
it { expect(subject.file_size).to be_blank }
|
54
|
-
it { expect(subject.checksum).to be_blank }
|
55
|
-
it { expect(subject.audio_codec).to be_blank }
|
56
|
-
it { expect(subject.video_codec).to be_blank }
|
57
|
-
it { expect(subject.audio_bitrate).to be_blank }
|
58
|
-
it { expect(subject.video_bitrate).to be_blank }
|
59
|
-
it { expect(subject.state).to eq :running }
|
60
|
-
it { expect(subject.created_at).to eq "2015-06-10T14:38:47Z" }
|
61
|
-
it { expect(subject.updated_at).to eq "2015-06-10T14:38:00Z" }
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'output' do
|
65
|
-
subject { output.first }
|
66
|
-
let(:output) { ActiveEncode::Base.find('166019107').reload.output }
|
67
|
-
|
68
|
-
it 'is an array' do
|
69
|
-
expect(output).to be_a Array
|
70
|
-
end
|
71
|
-
it { is_expected.to be_a ActiveEncode::Output }
|
72
|
-
it { expect(subject.id).to eq "511404522" }
|
73
|
-
it { expect(subject.url).to eq "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150610/c09b61e4d130ddf923f0653418a80b9c/399ae101c3f99b4f318635e78a4e587a.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=GY/9LMkQAiDOrMQwS5BkmOE200s%3D&Expires=1434033527" }
|
74
|
-
it { expect(subject.label).to be_blank }
|
75
|
-
it { expect(subject.width).to be_blank }
|
76
|
-
it { expect(subject.height).to be_blank }
|
77
|
-
it { expect(subject.frame_rate).to be_blank }
|
78
|
-
it { expect(subject.duration).to be_blank }
|
79
|
-
it { expect(subject.file_size).to be_blank }
|
80
|
-
it { expect(subject.checksum).to be_blank }
|
81
|
-
it { expect(subject.audio_codec).to be_blank }
|
82
|
-
it { expect(subject.video_codec).to be_blank }
|
83
|
-
it { expect(subject.audio_bitrate).to be_blank }
|
84
|
-
it { expect(subject.video_bitrate).to be_blank }
|
85
|
-
it { expect(subject.state).to eq :running }
|
86
|
-
it { expect(subject.created_at).to eq "2015-06-10T14:38:47Z" }
|
87
|
-
it { expect(subject.updated_at).to eq "2015-06-10T14:38:47Z" }
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe "#find" do
|
92
|
-
before do
|
93
|
-
allow(Zencoder::Job).to receive(:details).and_return(details_response)
|
94
|
-
allow(Zencoder::Job).to receive(:progress).and_return(progress_response)
|
95
|
-
end
|
96
|
-
|
97
|
-
context "a running encode" do
|
98
|
-
subject { ActiveEncode::Base.find('166019107') }
|
99
|
-
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_running.json'))) }
|
100
|
-
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_running.json'))) }
|
101
|
-
# let(:running_output) { [{ id: "510582971", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106", label: nil }] }
|
102
|
-
# let(:running_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
103
|
-
|
104
|
-
it { is_expected.to be_a ActiveEncode::Base }
|
105
|
-
it { expect(subject.id).to eq '166019107' }
|
106
|
-
it { is_expected.to be_running }
|
107
|
-
# it { expect(subject.output).to eq running_output }
|
108
|
-
it { expect(subject.current_operations).to be_empty }
|
109
|
-
it { expect(subject.percent_complete).to eq 30.0 }
|
110
|
-
it { expect(subject.errors).to be_empty }
|
111
|
-
it { expect(subject.created_at).to eq '2015-06-09T16:18:26Z' }
|
112
|
-
it { expect(subject.updated_at).to eq '2015-06-09T16:18:28Z' }
|
113
|
-
|
114
|
-
# it { expect(subject.tech_metadata).to eq running_tech_metadata }
|
115
|
-
context 'input' do
|
116
|
-
subject { ActiveEncode::Base.find('166019107').input }
|
117
|
-
|
118
|
-
it { is_expected.to be_a ActiveEncode::Input }
|
119
|
-
it { expect(subject.id).to eq "165990056" }
|
120
|
-
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
121
|
-
it { expect(subject.width).to eq 320 }
|
122
|
-
it { expect(subject.height).to eq 240 }
|
123
|
-
it { expect(subject.frame_rate).to eq 29.97 }
|
124
|
-
it { expect(subject.duration).to eq 57_992 }
|
125
|
-
it { expect(subject.file_size).to be_blank }
|
126
|
-
it { expect(subject.checksum).to be_blank }
|
127
|
-
it { expect(subject.audio_codec).to eq "aac" }
|
128
|
-
it { expect(subject.video_codec).to eq "h264" }
|
129
|
-
it { expect(subject.audio_bitrate).to eq 52 }
|
130
|
-
it { expect(subject.video_bitrate).to eq 535 }
|
131
|
-
it { expect(subject.state).to eq :completed }
|
132
|
-
it { expect(subject.created_at).to eq "2015-06-09T16:18:26Z" }
|
133
|
-
it { expect(subject.updated_at).to eq "2015-06-09T16:18:32Z" }
|
134
|
-
end
|
135
|
-
|
136
|
-
context 'output' do
|
137
|
-
subject { output.first }
|
138
|
-
let(:output) { ActiveEncode::Base.find('166019107').output }
|
139
|
-
|
140
|
-
it 'is an array' do
|
141
|
-
expect(output).to be_a Array
|
142
|
-
end
|
143
|
-
it { is_expected.to be_a ActiveEncode::Output }
|
144
|
-
it { expect(subject.id).to eq "510582971" }
|
145
|
-
it { expect(subject.url).to eq "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106" }
|
146
|
-
it { expect(subject.label).to be_blank }
|
147
|
-
it { expect(subject.width).to be_blank }
|
148
|
-
it { expect(subject.height).to be_blank }
|
149
|
-
it { expect(subject.frame_rate).to be_blank }
|
150
|
-
it { expect(subject.duration).to be_blank }
|
151
|
-
it { expect(subject.file_size).to be_blank }
|
152
|
-
it { expect(subject.checksum).to be_blank }
|
153
|
-
it { expect(subject.audio_codec).to be_blank }
|
154
|
-
it { expect(subject.video_codec).to be_blank }
|
155
|
-
it { expect(subject.audio_bitrate).to be_blank }
|
156
|
-
it { expect(subject.video_bitrate).to be_blank }
|
157
|
-
it { expect(subject.state).to eq :running }
|
158
|
-
it { expect(subject.created_at).to eq "2015-06-09T16:18:26Z" }
|
159
|
-
it { expect(subject.updated_at).to eq "2015-06-09T16:18:32Z" }
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
context "a cancelled encode" do
|
164
|
-
subject { ActiveEncode::Base.find('165866551') }
|
165
|
-
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_cancelled.json'))) }
|
166
|
-
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_cancelled.json'))) }
|
167
|
-
|
168
|
-
it { is_expected.to be_a ActiveEncode::Base }
|
169
|
-
it { expect(subject.id).to eq '165866551' }
|
170
|
-
it { is_expected.to be_cancelled }
|
171
|
-
it { expect(subject.current_operations).to be_empty }
|
172
|
-
it { expect(subject.percent_complete).to eq 0 }
|
173
|
-
it { expect(subject.errors).to be_empty }
|
174
|
-
it { expect(subject.created_at).to eq '2015-06-08T20:43:23Z' }
|
175
|
-
it { expect(subject.updated_at).to eq '2015-06-08T20:43:26Z' }
|
176
|
-
|
177
|
-
context 'input' do
|
178
|
-
subject { ActiveEncode::Base.find('165866551').input }
|
179
|
-
|
180
|
-
it { is_expected.to be_a ActiveEncode::Input }
|
181
|
-
it { expect(subject.id).to eq "165837500" }
|
182
|
-
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
183
|
-
it { expect(subject.width).to be_blank }
|
184
|
-
it { expect(subject.height).to be_blank }
|
185
|
-
it { expect(subject.frame_rate).to be_blank }
|
186
|
-
it { expect(subject.duration).to be_blank }
|
187
|
-
it { expect(subject.file_size).to be_blank }
|
188
|
-
it { expect(subject.checksum).to be_blank }
|
189
|
-
it { expect(subject.audio_codec).to be_blank }
|
190
|
-
it { expect(subject.video_codec).to be_blank }
|
191
|
-
it { expect(subject.audio_bitrate).to be_blank }
|
192
|
-
it { expect(subject.video_bitrate).to be_blank }
|
193
|
-
it { expect(subject.state).to eq :cancelled }
|
194
|
-
it { expect(subject.created_at).to eq "2015-06-08T20:43:23Z" }
|
195
|
-
it { expect(subject.updated_at).to eq "2015-06-08T20:43:26Z" }
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
context "a completed encode" do
|
200
|
-
subject { ActiveEncode::Base.find('165839139') }
|
201
|
-
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_completed.json'))) }
|
202
|
-
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_completed.json'))) }
|
203
|
-
let(:completed_output) { { id: "509856876", audio_bitrate: "53", audio_codec: "aac", audio_channels: "2", duration: "5000", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "549", video_codec: "h264", width: "320", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150608/ebbe865f8ef1b960d7c2bb0663b88a12/0f1948dcb2fd701fba30ff21908fe460.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=1LgIyl/el9E7zeyPxzd/%2BNwez6Y%3D&Expires=1433873646", label: nil } }
|
204
|
-
# let(:completed_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
205
|
-
|
206
|
-
it { is_expected.to be_a ActiveEncode::Base }
|
207
|
-
it { expect(subject.id).to eq '165839139' }
|
208
|
-
it { is_expected.to be_completed }
|
209
|
-
# it { expect(subject.output).to include completed_output }
|
210
|
-
it { expect(subject.current_operations).to be_empty }
|
211
|
-
it { expect(subject.percent_complete).to eq 100 }
|
212
|
-
it { expect(subject.errors).to be_empty }
|
213
|
-
it { expect(subject.created_at).to eq '2015-06-08T18:13:53Z' }
|
214
|
-
it { expect(subject.updated_at).to eq '2015-06-08T18:14:06Z' }
|
215
|
-
|
216
|
-
context 'input' do
|
217
|
-
subject { ActiveEncode::Base.find('165839139').input }
|
218
|
-
|
219
|
-
it { is_expected.to be_a ActiveEncode::Input }
|
220
|
-
it { expect(subject.id).to eq "165810088" }
|
221
|
-
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
222
|
-
it { expect(subject.width).to eq 320 }
|
223
|
-
it { expect(subject.height).to eq 240 }
|
224
|
-
it { expect(subject.frame_rate).to eq 29.97 }
|
225
|
-
it { expect(subject.duration).to eq 57_992 }
|
226
|
-
it { expect(subject.file_size).to be_blank }
|
227
|
-
it { expect(subject.checksum).to be_blank }
|
228
|
-
it { expect(subject.audio_codec).to eq "aac" }
|
229
|
-
it { expect(subject.video_codec).to eq "h264" }
|
230
|
-
it { expect(subject.audio_bitrate).to eq 52 }
|
231
|
-
it { expect(subject.video_bitrate).to eq 535 }
|
232
|
-
it { expect(subject.state).to eq :completed }
|
233
|
-
it { expect(subject.created_at).to eq "2015-06-08T18:13:53Z" }
|
234
|
-
it { expect(subject.updated_at).to eq "2015-06-08T18:14:06Z" }
|
235
|
-
end
|
236
|
-
|
237
|
-
context 'output' do
|
238
|
-
subject { output.first }
|
239
|
-
let(:output) { ActiveEncode::Base.find('166019107').reload.output }
|
240
|
-
|
241
|
-
it 'is an array' do
|
242
|
-
expect(output).to be_a Array
|
243
|
-
end
|
244
|
-
it { is_expected.to be_a ActiveEncode::Output }
|
245
|
-
it { expect(subject.id).to eq "509856876" }
|
246
|
-
it { expect(subject.url).to eq "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150608/ebbe865f8ef1b960d7c2bb0663b88a12/0f1948dcb2fd701fba30ff21908fe460.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=1LgIyl/el9E7zeyPxzd/%2BNwez6Y%3D&Expires=1433873646" }
|
247
|
-
it { expect(subject.label).to be_blank }
|
248
|
-
it { expect(subject.width).to eq 320 }
|
249
|
-
it { expect(subject.height).to eq 240 }
|
250
|
-
it { expect(subject.frame_rate).to eq 29.97 }
|
251
|
-
it { expect(subject.duration).to eq 5000 }
|
252
|
-
it { expect(subject.file_size).to be_blank }
|
253
|
-
it { expect(subject.checksum).to be_blank }
|
254
|
-
it { expect(subject.audio_codec).to eq "aac" }
|
255
|
-
it { expect(subject.video_codec).to eq "h264" }
|
256
|
-
it { expect(subject.audio_bitrate).to eq 53 }
|
257
|
-
it { expect(subject.video_bitrate).to eq 549 }
|
258
|
-
it { expect(subject.state).to eq :completed }
|
259
|
-
it { expect(subject.created_at).to eq "2015-06-08T18:13:53Z" }
|
260
|
-
it { expect(subject.updated_at).to eq "2015-06-08T18:14:06Z" }
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
context "a failed encode" do
|
265
|
-
subject { ActiveEncode::Base.find('166079902') }
|
266
|
-
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_failed.json'))) }
|
267
|
-
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_failed.json'))) }
|
268
|
-
let(:failed_tech_metadata) { { mime_type: "video/mp4", checksum: "7ae24368ccb7a6c6422a14ff73f33c9a", duration: "6314", audio_codec: "AAC", audio_channels: "2", audio_bitrate: "171030.0", video_codec: "AVC", video_bitrate: "74477.0", video_framerate: "23.719", width: "200", height: "110" } }
|
269
|
-
let(:failed_errors) { "The file is an XML file, and doesn't contain audio or video tracks." }
|
270
|
-
|
271
|
-
it { is_expected.to be_a ActiveEncode::Base }
|
272
|
-
it { expect(subject.id).to eq '166079902' }
|
273
|
-
it { is_expected.to be_failed }
|
274
|
-
it { expect(subject.current_operations).to be_empty }
|
275
|
-
it { expect(subject.percent_complete).to eq 0 }
|
276
|
-
it { expect(subject.errors).to be_empty }
|
277
|
-
it { expect(subject.created_at).to eq '2015-06-09T20:52:57Z' }
|
278
|
-
it { expect(subject.updated_at).to eq '2015-06-09T20:53:00Z' }
|
279
|
-
|
280
|
-
context 'input' do
|
281
|
-
subject { ActiveEncode::Base.find('165866551').input }
|
282
|
-
|
283
|
-
it { is_expected.to be_a ActiveEncode::Input }
|
284
|
-
it { expect(subject.id).to eq "166050851" }
|
285
|
-
it { expect(subject.url).to eq "s3://zencoder-customer-ingest/uploads/2015-06-09/240330/187007/682c2d90-0eea-11e5-84c9-f158f44c3d50.xml" }
|
286
|
-
it { expect(subject.errors).to include failed_errors }
|
287
|
-
it { expect(subject.width).to be_blank }
|
288
|
-
it { expect(subject.height).to be_blank }
|
289
|
-
it { expect(subject.frame_rate).to be_blank }
|
290
|
-
it { expect(subject.duration).to be_blank }
|
291
|
-
it { expect(subject.file_size).to be_blank }
|
292
|
-
it { expect(subject.checksum).to be_blank }
|
293
|
-
it { expect(subject.audio_codec).to be_blank }
|
294
|
-
it { expect(subject.video_codec).to be_blank }
|
295
|
-
it { expect(subject.audio_bitrate).to be_blank }
|
296
|
-
it { expect(subject.video_bitrate).to be_blank }
|
297
|
-
it { expect(subject.state).to eq :failed }
|
298
|
-
it { expect(subject.created_at).to eq "2015-06-09T20:52:57Z" }
|
299
|
-
it { expect(subject.updated_at).to eq "2015-06-09T20:53:00Z" }
|
300
|
-
end
|
301
|
-
end
|
302
|
-
end
|
303
|
-
|
304
|
-
describe "#cancel!" do
|
305
|
-
subject { encode.cancel! }
|
306
|
-
before do
|
307
|
-
allow(Zencoder::Job).to receive(:cancel).and_return(cancel_response)
|
308
|
-
allow(Zencoder::Job).to receive(:details).and_return(details_response)
|
309
|
-
allow(Zencoder::Job).to receive(:progress).and_return(progress_response)
|
310
|
-
end
|
311
|
-
|
312
|
-
let(:cancel_response) { Zencoder::Response.new(code: 200) } # TODO: check that this is the correct response code for a successful cancel
|
313
|
-
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_cancelled.json'))) }
|
314
|
-
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_cancelled.json'))) }
|
315
|
-
|
316
|
-
let(:encode) { ActiveEncode::Base.create(file) }
|
317
|
-
it { is_expected.to be_a ActiveEncode::Base }
|
318
|
-
it { expect(subject.id).to eq '165866551' }
|
319
|
-
it { is_expected.to be_cancelled }
|
320
|
-
end
|
321
|
-
|
322
|
-
describe "reload" do
|
323
|
-
subject { ActiveEncode::Base.find('166019107').reload }
|
324
|
-
before do
|
325
|
-
allow(Zencoder::Job).to receive(:details).and_return(details_response)
|
326
|
-
allow(Zencoder::Job).to receive(:progress).and_return(progress_response)
|
327
|
-
end
|
328
|
-
|
329
|
-
let(:details_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_details_running.json'))) }
|
330
|
-
let(:progress_response) { Zencoder::Response.new(body: JSON.parse(File.read('spec/fixtures/zencoder/job_progress_running.json'))) }
|
331
|
-
# let(:reload_output) { [{ id: "510582971", url: "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106", label: nil }] }
|
332
|
-
# let(:reload_tech_metadata) { { audio_bitrate: "52", audio_codec: "aac", audio_channels: "2", duration: "57992", mime_type: "mpeg4", video_framerate: "29.97", height: "240", video_bitrate: "535", video_codec: "h264", width: "320" } }
|
333
|
-
|
334
|
-
it { is_expected.to be_a ActiveEncode::Base }
|
335
|
-
it { expect(subject.id).to eq '166019107' }
|
336
|
-
it { is_expected.to be_running }
|
337
|
-
# it { expect(subject.output).to eq reload_output }
|
338
|
-
it { expect(subject.current_operations).to be_empty }
|
339
|
-
it { expect(subject.percent_complete).to eq 30.0 }
|
340
|
-
it { expect(subject.errors).to be_empty }
|
341
|
-
it { expect(subject.created_at).to eq '2015-06-09T16:18:26Z' }
|
342
|
-
it { expect(subject.updated_at).to eq '2015-06-09T16:18:28Z' }
|
343
|
-
|
344
|
-
context 'input' do
|
345
|
-
subject { ActiveEncode::Base.find('166019107').reload.input }
|
346
|
-
|
347
|
-
it { is_expected.to be_a ActiveEncode::Input }
|
348
|
-
it { expect(subject.id).to eq "165990056" }
|
349
|
-
it { expect(subject.url).to eq "https://archive.org/download/LuckyStr1948_2/LuckyStr1948_2_512kb.mp4" }
|
350
|
-
it { expect(subject.width).to eq 320 }
|
351
|
-
it { expect(subject.height).to eq 240 }
|
352
|
-
it { expect(subject.frame_rate).to eq 29.97 }
|
353
|
-
it { expect(subject.duration).to eq 57_992 }
|
354
|
-
it { expect(subject.file_size).to be_blank }
|
355
|
-
it { expect(subject.checksum).to be_blank }
|
356
|
-
it { expect(subject.audio_codec).to eq "aac" }
|
357
|
-
it { expect(subject.video_codec).to eq "h264" }
|
358
|
-
it { expect(subject.audio_bitrate).to eq 52 }
|
359
|
-
it { expect(subject.video_bitrate).to eq 535 }
|
360
|
-
it { expect(subject.state).to eq :completed }
|
361
|
-
it { expect(subject.created_at).to eq "2015-06-09T16:18:26Z" }
|
362
|
-
it { expect(subject.updated_at).to eq "2015-06-09T16:18:32Z" }
|
363
|
-
end
|
364
|
-
|
365
|
-
context 'output' do
|
366
|
-
subject { output.first }
|
367
|
-
let(:output) { ActiveEncode::Base.find('166019107').reload.output }
|
368
|
-
|
369
|
-
it 'is an array' do
|
370
|
-
expect(output).to be_a Array
|
371
|
-
end
|
372
|
-
it { is_expected.to be_a ActiveEncode::Output }
|
373
|
-
it { expect(subject.id).to eq "510582971" }
|
374
|
-
it { expect(subject.url).to eq "https://zencoder-temp-storage-us-east-1.s3.amazonaws.com/o/20150609/48a6907086c012f68b9ca43461280515/1726d7ec3e24f2171bd07b2abb807b6c.mp4?AWSAccessKeyId=AKIAI456JQ76GBU7FECA&Signature=vSvlxU94wlQLEbpG3Zs8ibp4MoY%3D&Expires=1433953106" }
|
375
|
-
it { expect(subject.label).to be_blank }
|
376
|
-
it { expect(subject.width).to be_blank }
|
377
|
-
it { expect(subject.height).to be_blank }
|
378
|
-
it { expect(subject.frame_rate).to be_blank }
|
379
|
-
it { expect(subject.duration).to be_blank }
|
380
|
-
it { expect(subject.file_size).to be_blank }
|
381
|
-
it { expect(subject.checksum).to be_blank }
|
382
|
-
it { expect(subject.audio_codec).to be_blank }
|
383
|
-
it { expect(subject.video_codec).to be_blank }
|
384
|
-
it { expect(subject.audio_bitrate).to be_blank }
|
385
|
-
it { expect(subject.video_bitrate).to be_blank }
|
386
|
-
it { expect(subject.state).to eq :running }
|
387
|
-
it { expect(subject.created_at).to eq "2015-06-09T16:18:26Z" }
|
388
|
-
it { expect(subject.updated_at).to eq "2015-06-09T16:18:32Z" }
|
389
|
-
end
|
390
|
-
end
|
391
|
-
end
|
data/spec/rails_helper.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
require 'engine_cart'
|
5
|
-
EngineCart.load_application!
|
6
|
-
|
7
|
-
require 'rspec/rails'
|
8
|
-
ActiveJob::Base.queue_adapter = :test
|
9
|
-
|
10
|
-
require 'database_cleaner'
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
config.before do |example|
|
14
|
-
if example.metadata[:db_clean]
|
15
|
-
DatabaseCleaner.clean_with(:truncation)
|
16
|
-
DatabaseCleaner.strategy = :truncation
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
config.after do |example|
|
21
|
-
DatabaseCleaner.clean if example.metadata[:db_clean]
|
22
|
-
end
|
23
|
-
|
24
|
-
config.include ActiveSupport::Testing::TimeHelpers
|
25
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'rails_helper'
|
3
|
-
|
4
|
-
describe ActiveEncode::EncodeRecordController, type: :routing do
|
5
|
-
routes { ActiveEncode::Engine.routes }
|
6
|
-
|
7
|
-
it "routes to the show action" do
|
8
|
-
expect(get: encode_record_path(1)).to route_to(controller: "active_encode/encode_record", action: "show", id: "1")
|
9
|
-
end
|
10
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'coveralls'
|
3
|
-
Coveralls.wear!
|
4
|
-
|
5
|
-
require 'bundler/setup'
|
6
|
-
Bundler.setup
|
7
|
-
|
8
|
-
require 'byebug'
|
9
|
-
require 'active_encode'
|
10
|
-
|
11
|
-
RSpec.configure do |_config|
|
12
|
-
end
|
13
|
-
|
14
|
-
RSpec::Matchers.define :be_the_same_time_as do |expected|
|
15
|
-
match do |actual|
|
16
|
-
expect(Time.parse(expected).utc).to eq(Time.parse(actual).utc)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
RSpec::Matchers.define_negated_matcher :not_change, :change
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
require 'rails/generators'
|
4
|
-
|
5
|
-
class TestAppGenerator < Rails::Generators::Base
|
6
|
-
source_root "./spec/test_app_templates"
|
7
|
-
|
8
|
-
# if you need to generate any additional configuration
|
9
|
-
# into the test app, this generator will be run immediately
|
10
|
-
# after setting up the application
|
11
|
-
|
12
|
-
def install_engine
|
13
|
-
generate 'active_encode:install'
|
14
|
-
rake 'active_encode:install:migrations'
|
15
|
-
end
|
16
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe ActiveEncode::Callbacks do
|
5
|
-
before do
|
6
|
-
class CallbackEncode < ActiveEncode::Base
|
7
|
-
after_find ->(encode) { encode.history << "CallbackEncode ran after_find" }
|
8
|
-
|
9
|
-
after_reload ->(encode) { encode.history << "CallbackEncode ran after_reload" }
|
10
|
-
|
11
|
-
before_create ->(encode) { encode.history << "CallbackEncode ran before_create" }
|
12
|
-
after_create ->(encode) { encode.history << "CallbackEncode ran after_create" }
|
13
|
-
|
14
|
-
before_cancel ->(encode) { encode.history << "CallbackEncode ran before_cancel" }
|
15
|
-
after_cancel ->(encode) { encode.history << "CallbackEncode ran after_cancel" }
|
16
|
-
|
17
|
-
around_create do |encode, block|
|
18
|
-
encode.history << "CallbackEncode ran around_create_start"
|
19
|
-
block.call
|
20
|
-
encode.history << "CallbackEncode ran around_create_stop"
|
21
|
-
end
|
22
|
-
|
23
|
-
around_cancel do |encode, block|
|
24
|
-
encode.history << "CallbackEncode ran around_cancel_start"
|
25
|
-
block.call
|
26
|
-
encode.history << "CallbackEncode ran around_cancel_stop"
|
27
|
-
end
|
28
|
-
|
29
|
-
def history
|
30
|
-
@history ||= []
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
after do
|
36
|
-
Object.send(:remove_const, :CallbackEncode)
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'find callback' do
|
40
|
-
subject { CallbackEncode.find(encode.id).history }
|
41
|
-
let(:encode) { CallbackEncode.create("sample.mp4") }
|
42
|
-
it { is_expected.to include("CallbackEncode ran after_find") }
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'reload callback' do
|
46
|
-
subject { encode.reload.history }
|
47
|
-
let(:encode) { CallbackEncode.create("sample.mp4") }
|
48
|
-
it { is_expected.to include("CallbackEncode ran after_reload") }
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'create callbacks' do
|
52
|
-
subject { CallbackEncode.create("sample.mp4").history }
|
53
|
-
it { is_expected.to include("CallbackEncode ran before_create") }
|
54
|
-
it { is_expected.to include("CallbackEncode ran after_create") }
|
55
|
-
it { is_expected.to include("CallbackEncode ran around_create_start") }
|
56
|
-
it { is_expected.to include("CallbackEncode ran around_create_stop") }
|
57
|
-
end
|
58
|
-
|
59
|
-
describe 'cancel callbacks' do
|
60
|
-
subject { CallbackEncode.create("sample.mp4").cancel!.history }
|
61
|
-
it { is_expected.to include("CallbackEncode ran before_cancel") }
|
62
|
-
it { is_expected.to include("CallbackEncode ran after_cancel") }
|
63
|
-
it { is_expected.to include("CallbackEncode ran around_cancel_start") }
|
64
|
-
it { is_expected.to include("CallbackEncode ran around_cancel_stop") }
|
65
|
-
end
|
66
|
-
end
|