Sha256: 2416d9497bcdf81fbb0ce12677ae6532977417332a30cb4b6d7eccde1f4f8878

Contents?: true

Size: 909 Bytes

Versions: 2

Compression:

Stored size: 909 Bytes

Contents

require 'test_helper'
require "ui_bibz/ui/table/components/store"
require 'will_paginate'

class StoreTest < ActionView::TestCase
  include WillPaginate::ActionView

  setup do
    create_list(:user, 25)
    params = {
      controller: 'users',
      action:     'index',
      sort:       'users.name_fr',
      direction:  'asc',
      per_page:   10,
      page:       1
    }
    users  = User.table_search_pagination(params, session)
    @store = UiBibz::Ui::Store.new users
  end

  test 'total pages' do
    assert_equal @store.total_pages, 3
  end

  test 'current page' do
    assert_equal @store.current_page, 1
  end

  test 'limit value' do
    assert_equal @store.limit_value, 10
  end

  test 'model' do
    assert_equal @store.model, User
  end

  test 'records' do
    assert_equal @store.records.count, 25
  end

  test 'controller' do
    assert_equal @store.controller, 'users'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ui_bibz-1.0.0 test/store_test.rb
ui_bibz-0.9.0 test/store_test.rb