Sha256: 617776d1442adb66ae8df7b3af025bfe7db745f8040a2a3e8bee995ace16dc3a

Contents?: true

Size: 904 Bytes

Versions: 3

Compression:

Stored size: 904 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "PeopleController" do
  before(:each) do
    @people_controller = PeopleController.new
    
    10.times do |i|
      Fabricate(:person)
    end
    
    @params = {
      :searchable_columns => ["first_name", "last_name", "age", "date_of_birth", "gender"],
      :column_search => {},
      :limit => "5",
      :offset => "0",
      :search => "",
      :sort_column => "",
      :sort_direction => ""
    }
  end
  
  it "should have the jtable_for_json method" do
    @people_controller.respond_to?(:jtable_for_json).should be_true
  end
  
  it "should return the appropriate json" do
    people = Person.jtable_query(@params)
    @people_controller.jtable_for_json(people, @params).to_json.should eql({:total_items => people.count, :items => people.jtable_paginate(@params[:limit], @params[:offset])}.to_json)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jtable-rails-0.1.2 spec/controller_specs/people_controller_spec.rb
jtable-rails-0.1.1 spec/controller_specs/people_controller_spec.rb
jtable-rails-0.1.0 spec/controller_specs/people_controller_spec.rb