Sha256: 6adfc953827e43ca6b868704cdf739a41c27511c76af97b9094452fe60c3f711

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

describe PlayTime::Upload do
  describe '.upload' do
    let(:upload) { instance_double(PlayTime::Upload) }
    let(:client) { instance_double(PlayTime::Client) }

    subject { PlayTime::Upload.upload('track') }

    before do
      allow(upload).to receive(:upload)
      allow(PlayTime::Client).to receive(:new).and_return(client)
      allow(PlayTime::Upload).to receive(:new).and_return(upload)
    end

    it 'uploads the track' do
      subject

      expect(upload).to have_received(:upload).with('track')
    end

    it 'instantiates upload with new authorization and client' do
      subject

      expect(PlayTime::Upload).to have_received(:new).with(client)
    end
  end

  describe '#upload' do
    let(:client) { instance_double(PlayTime::Client) }
    let(:upload) { PlayTime::Upload.new(client) }

    subject { upload.upload('track') }

    before do
      allow(client).to receive(:authorize!)
      allow(client).to receive(:commit)
    end

    it 'authroizes the client' do
      subject

      expect(client).to have_received(:authorize!)
    end

    it 'commits the track' do
      subject

      expect(client).to have_received(:commit).with('track')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
play_time-0.1.2 spec/lib/upload_spec.rb
play_time-0.1.1 spec/lib/upload_spec.rb
play_time-0.1.0 spec/lib/upload_spec.rb
play_time-0.0.3 spec/upload_spec.rb
play_time-0.0.2 spec/upload_spec.rb
play_time-0.0.1 spec/upload_spec.rb