Sha256: 69b8b6a0c5866763b3d589984fba1e5c1fb93d83c44c8eeb8d43c9c80f87e72a
Contents?: true
Size: 1.38 KB
Versions: 11
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe ActiveEncode::Input do subject { described_class.new } describe 'attributes' do it { is_expected.to respond_to(:id, :url) } 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_input) do described_class.new.tap do |obj| obj.id = "1" obj.url = "file:///tmp/video.mp4" obj.created_at = Time.now.utc obj.updated_at = Time.now.utc end end it 'returns true when conditions met' do expect(valid_input).to be_valid end it 'returns false when conditions not met' do expect(valid_input.tap { |obj| obj.id = nil }).not_to be_valid expect(valid_input.tap { |obj| obj.url = nil }).not_to be_valid expect(valid_input.tap { |obj| obj.created_at = nil }).not_to be_valid expect(valid_input.tap { |obj| obj.created_at = "today" }).not_to be_valid expect(valid_input.tap { |obj| obj.updated_at = nil }).not_to be_valid expect(valid_input.tap { |obj| obj.updated_at = "today" }).not_to be_valid expect(valid_input.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