Sha256: 8b341c5d07e404c74b57db3c262a4118730e75387da69d7392ccc5a3112a7bb8

Contents?: true

Size: 646 Bytes

Versions: 3

Compression:

Stored size: 646 Bytes

Contents

require 'spec_helper'

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

    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-1.2.0 spec/ajax-datatables-rails/extended_spec.rb
ajax-datatables-rails-1.1.0 spec/ajax-datatables-rails/extended_spec.rb
ajax-datatables-rails-1.0.0 spec/ajax-datatables-rails/extended_spec.rb