Sha256: a61257897c7975ffcc32b5e171af43630e2c618c8a665ab14eb72d90027a0bdb

Contents?: true

Size: 731 Bytes

Versions: 4

Compression:

Stored size: 731 Bytes

Contents

require 'spec_helper'

describe AjaxDatatablesRails::ORM::ActiveRecord do
  context 'Private API' do
    let(:datatable) { ComplexDatatable.new(sample_params) }

    before(:each) do
      create(:user, username: 'johndoe', email: 'johndoe@example.com')
      create(:user, username: 'msmith', email: 'mary.smith@example.com')
    end

    describe '#fetch_records' do
      it 'calls #get_raw_records' do
        expect(datatable).to receive(:get_raw_records) { User.all }
        datatable.fetch_records
      end

      it 'returns a collection of records' do
        expect(datatable).to receive(:get_raw_records) { User.all }
        expect(datatable.fetch_records).to be_a(ActiveRecord::Relation)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ajax-datatables-rails-1.3.0 spec/ajax-datatables-rails/orm/active_record_spec.rb
ajax-datatables-rails-1.2.0 spec/ajax-datatables-rails/orm/active_record_spec.rb
ajax-datatables-rails-1.1.0 spec/ajax-datatables-rails/orm/active_record_spec.rb
ajax-datatables-rails-1.0.0 spec/ajax-datatables-rails/orm/active_record_spec.rb