Sha256: 75140a76e1b982d65feb9c5834c2c00ea1f6d70c27d63e042a3ab2076158f633

Contents?: true

Size: 694 Bytes

Versions: 3

Compression:

Stored size: 694 Bytes

Contents

require 'spec_helper'

describe AjaxDatatablesRails::Base do
  describe 'it can transform search value before asking the database' do
    let(:view) { double('view', params: sample_params) }
    let(:datatable) { DatatableWithFormater.new(view) }

    before(:each) do
      create(:user, username: 'johndoe', email: 'johndoe@example.com', last_name: 'DOE')
      create(:user, username: 'msmith', email: 'mary.smith@example.com', last_name: 'SMITH')
      datatable.params[:columns]['3'][:search][:value] = 'doe'
    end

    it 'should filter records' do
      expect(datatable.data.size).to eq 1
      item = datatable.data.first
      expect(item[:last_name]).to eq 'DOE'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ajax-datatables-rails-0.4.3 spec/ajax-datatables-rails/extended_spec.rb
ajax-datatables-rails-0.4.2 spec/ajax-datatables-rails/extended_spec.rb
ajax-datatables-rails-0.4.1 spec/ajax-datatables-rails/extended_spec.rb