Sha256: 29d86f0e2167f04785aad502f7e26caa52c7bf5a620adeb1b9eb03a02a5c5c53
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Github::PagedRequest, '#page_request' do let(:current_api) { Github::Repos.new } let(:path) { "/repositories/"} let(:klass) { klass = Class.new do include Github::PagedRequest end } subject(:instance) { klass.new } before { instance.stub(:current_api).and_return current_api } it { klass.constants.should include :FIRST_PAGE } it { klass.constants.should include :PER_PAGE } it { klass.constants.should include :NOT_FOUND } it { should respond_to(:page_request) } it 'calls get_request on api current instance' do current_api.should_receive(:get_request).with(path, {}) instance.page_request(path) end it 'sets default per_page when only custom page passed' do current_api.should_receive(:get_request). with(path, {'page' => 3, 'per_page' => 30}) instance.page_request(path, {'page' => 3, 'per_page' => -1}) end it 'sets default page when only custom per_page passed' do current_api.should_receive(:get_request). with(path, {'page' => 1, 'per_page' => 33}) instance.page_request(path, {'page' => -1, 'per_page' => 33}) end end # Github::PagedRequest
Version data entries
15 entries across 15 versions & 1 rubygems