Sha256: 6d76a66dfe18c6e7a3d6d660642252d9ee84463b0d1cabe17c0f5ce601b5d43e

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'
require_relative 'spec_helper_rr'
require 'kaminari_rspec'
include KaminariRspec::TestHelpers

describe 'KaminariRspec::TestHelpers::', :rr => true do

  describe 'discover_mock_framework' do

    context 'when the framework is rr' do

      it 'should return rr' do
        discover_mock_framework.should == :rr
      end

    end

  end

  describe 'stub_pagination' do

    context 'when passed a nil resource' do

      it 'returns nil' do
        result = stub_pagination(nil)
        result.should be_nil
      end

    end

    context 'when passed a non nil resource' do

      # we check for total_count, to know if the stubbing was successful, no need to check for each
      # method individually
      it 'has the total_count method stubbed' do
        resource = Object.new
        result = stub_pagination(resource, :mock => :rr, :total_count => 23)
        result.total_count.should == 23
      end

      context 'and an unknown mocking framework' do

        it 'raises an error' do
          resource = Object.new
          expect { stub_pagination(resource, :mock => :my_mock)}.to raise_error(ArgumentError)

        end

      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kaminari-rspec-0.16.1 spec/lib/kaminari_rspec/rr/test_helpers_spec.rb
kaminari-rspec-0.14.1 spec/lib/kaminari_rspec/rr/test_helpers_spec.rb
kaminari-rspec-0.14.1.b1 spec/lib/kaminari_rspec/rr/test_helpers_spec.rb
kaminari-rspec-0.14.1.b0 spec/lib/kaminari_rspec/rr/test_helpers_spec.rb