Sha256: 3c31a9135c9f2bdc0769e19034a7276314de43f977007d22bee452d540c085de

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

require_relative '../../spec_helper'

describe 'GET /attachments/{id}' do
  let(:client) { Rev.new('welcome', 'AAAAAu/YjZ3phXU5FsF35yIcgiA=', 'www.revtrunk.com') }

  it 'must retrieve metadata' do
    VCR.insert_cassette 'get_attachment_metadata'

    attachment = client.get_attachment_metadata('LufnCVQCAAAAAAAA')

    assert_requested :get, /.*\/api\/v1\/attachments\/LufnCVQCAAAAAAAA/, :times => 1

    attachment.id.must_equal 'LufnCVQCAAAAAAAA'
    attachment.name.must_equal 'How can I find success in life.mp4'
    attachment.kind.must_equal 'media'
    attachment.audio_length.must_equal 5
    attachment.links.must_be_instance_of Array
    attachment.links.size.must_equal 1
    attachment.links.first.rel.must_equal 'content'
    attachment.links.first.href.must_equal 'https://www.revtrunk.com/api/v1/attachments/LufnCVQCAAAAAAAA/content'
  end

  it 'must raise NotFoundError when attachment id is invalid' do
    VCR.insert_cassette 'get_attachment_with_invalid_id'

    action = lambda { client.get_attachment_metadata('trololo') }
    action.must_raise Rev::NotFoundError
  end

  after do
    VCR.eject_cassette
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rev-api-1.0.4 spec/lib/rev/get_attachment_metadata_spec.rb
rev-api-1.0.3 spec/lib/rev/get_attachment_metadata_spec.rb
rev-api-1.0.2 spec/lib/rev/get_attachment_metadata_spec.rb
rev-api-1.0.1 spec/lib/rev/get_attachment_metadata_spec.rb
rev-api-1.0.0 spec/lib/rev/get_attachment_metadata_spec.rb