Sha256: 74bc141ba5aef3f6acffdc54c489fd541f3a58cd72163f6f2d08bfdef03b9ae5

Contents?: true

Size: 787 Bytes

Versions: 2

Compression:

Stored size: 787 Bytes

Contents

require 'spec_helper'

class WillPaginateDatatable < AjaxDatatablesRails::Base
end

describe WillPaginateDatatable do
  before(:each) do
    allow_any_instance_of(AjaxDatatablesRails::Configuration).to receive(:paginator) { :will_paginate }
  end

  describe '#paginate_records' do
    let(:users_database) do
      double('User',
        :all => double('RecordCollection',
          :paginate => double('Array', :per_page => [])
        )
      )
    end

    let(:datatable) { WillPaginateDatatable.new(double('view', :params => {})) }
    let(:records) { users_database.all }

    it 'calls #page and #per_page on passed record collection' do
      expect(records).to receive(:paginate).with(:page=>1, :per_page=>10)
      datatable.send(:paginate_records, records)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ajax-datatables-rails-0.3.1 spec/ajax-datatables-rails/will_paginate_spec.rb
ajax-datatables-rails-0.3.0 spec/ajax-datatables-rails/will_paginate_spec.rb