Sha256: da61a2a2dcb3161c9667e8f0fa933fb45641f7ce34b4e4584f565c19fc34e8b5

Contents?: true

Size: 1.49 KB

Versions: 11

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true
require 'spec_helper'

describe ActiveEncode::Output do
  subject { described_class.new }

  describe 'attributes' do
    it { is_expected.to respond_to(:id, :url, :label) }
    it { is_expected.to respond_to(:state, :errors, :created_at, :updated_at) }
    it {
      is_expected.to respond_to(:width, :height, :frame_rate, :checksum,
                                :audio_codec, :video_codec, :audio_bitrate, :video_bitrate)
    }
  end

  describe '#valid?' do
    let(:valid_output) do
      described_class.new.tap do |obj|
        obj.id = "1"
        obj.url = "file:///tmp/video.mp4"
        obj.label = "HD"
        obj.created_at = Time.now.utc
        obj.updated_at = Time.now.utc
      end
    end

    it 'returns true when conditions met' do
      expect(valid_output).to be_valid
    end

    it 'returns false when conditions not met' do
      expect(valid_output.tap { |obj| obj.id = nil }).not_to be_valid
      expect(valid_output.tap { |obj| obj.url = nil }).not_to be_valid
      expect(valid_output.tap { |obj| obj.label = nil }).not_to be_valid
      expect(valid_output.tap { |obj| obj.created_at = nil }).not_to be_valid
      expect(valid_output.tap { |obj| obj.created_at = "today" }).not_to be_valid
      expect(valid_output.tap { |obj| obj.updated_at = nil }).not_to be_valid
      expect(valid_output.tap { |obj| obj.updated_at = "today" }).not_to be_valid
      expect(valid_output.tap { |obj| obj.created_at = Time.now.utc }).not_to be_valid
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active_encode-1.2.0 spec/units/output_spec.rb
active_encode-1.1.3 spec/units/output_spec.rb
active_encode-1.1.2 spec/units/output_spec.rb
active_encode-1.1.1 spec/units/output_spec.rb
active_encode-1.1.0 spec/units/output_spec.rb
active_encode-1.0.0 spec/units/output_spec.rb
active_encode-0.8.2 spec/units/output_spec.rb
active_encode-0.8.1 spec/units/output_spec.rb
active_encode-0.8.0 spec/units/output_spec.rb
active_encode-0.7.0 spec/units/output_spec.rb
active_encode-0.6.0 spec/units/output_spec.rb