Sha256: a57d8ff0a9d584ede4cd472c5170fa4a1e359349916ea6185109c639d4ab72fb

Contents?: true

Size: 866 Bytes

Versions: 5

Compression:

Stored size: 866 Bytes

Contents

require 'spec_helper'

class KaminariDatatable < AjaxDatatablesRails::Base
  include AjaxDatatablesRails::Extensions::Kaminari
end

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

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

    it 'calls #page on passed record collection' do
      records.should_receive(:page)
      datatable.send(:paginate_records, records)
    end

    it 'calls #per_page on passed record collection' do
      arry = double('Array', :per => [])
      records.stub(:page).and_return(arry)
      arry.should_receive(:per)
      datatable.send(:paginate_records, records) 
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ajax-datatables-rails-0.2.1 spec/ajax-datatables-rails/kaminari_spec.rb
ajax-datatables-rails-0.2.0 spec/ajax-datatables-rails/kaminari_spec.rb
ajax-datatables-rails-0.1.2 spec/ajax-datatables-rails/kaminari_spec.rb
ajax-datatables-rails-0.1.1 spec/ajax-datatables-rails/kaminari_spec.rb
ajax-datatables-rails-0.1.0 spec/ajax-datatables-rails/kaminari_spec.rb