Sha256: a978f745cc7f998829be729b709d43309a40cf625dd9b15e837d5de995229454

Contents?: true

Size: 902 Bytes

Versions: 5

Compression:

Stored size: 902 Bytes

Contents

require 'spec_helper'

class SimplePaginateDatatable < AjaxDatatablesRails::Base
  include AjaxDatatablesRails::Extensions::SimplePaginator
end

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

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

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

    it 'calls #limit on passed record collection' do
      arry = double('Array', :limit => [])
      records.stub(:offset).and_return(arry)
      arry.should_receive(:limit)
      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/simple_paginator_spec.rb
ajax-datatables-rails-0.2.0 spec/ajax-datatables-rails/simple_paginator_spec.rb
ajax-datatables-rails-0.1.2 spec/ajax-datatables-rails/simple_paginator_spec.rb
ajax-datatables-rails-0.1.1 spec/ajax-datatables-rails/simple_paginator_spec.rb
ajax-datatables-rails-0.1.0 spec/ajax-datatables-rails/simple_paginator_spec.rb