Sha256: 229c389f1f45cb71d3c91eccc31c52cf0bbf63cac7ba25d0e0af3065bfdd83bb

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Dribbble::Base do
  before do
    @base = described_class.new 'valid_token', {}
  end

  describe 'on #full_url_with_default_params' do
    describe 'without params' do
      subject { @base.full_url_with_default_params '/shots' }

      it 'return a valid url' do
        expect(subject).to eq('https://api.dribbble.com/v2/shots?page=1&per_page=100')
      end
    end

    describe 'with default params overrided' do
      subject { @base.full_url_with_default_params '/shots', page: 2, per_page: 10 }

      it 'return a valid url' do
        expect(subject).to eq('https://api.dribbble.com/v2/shots?page=2&per_page=10')
      end
    end

    describe 'with extra params' do
      subject { @base.full_url_with_default_params '/shots', params1: 'custom' }

      it 'return a valid url' do
        expect(subject).to eq('https://api.dribbble.com/v2/shots?page=1&per_page=100&params1=custom')
      end
    end
  end

  describe 'on #full_url' do
    describe 'without params' do
      subject { @base.full_url '/shots' }

      it 'return a valid url' do
        expect(subject).to eq('https://api.dribbble.com/v2/shots?')
      end
    end

    describe 'with params' do
      subject { @base.full_url '/shots', custom: 1 }

      it 'return a valid url' do
        expect(subject).to eq('https://api.dribbble.com/v2/shots?custom=1')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dribbble-2.0.0 spec/lib/dribbble/base_spec.rb