Sha256: be2dba0d237e0fcd985be45f4f686e8e3e6cbdabe1c2d68658f7f75cf5284885

Contents?: true

Size: 1.2 KB

Versions: 15

Compression:

Stored size: 1.2 KB

Contents

require 'test_helper'

class RailsDbDataTableHelperTest < ActionView::TestCase
  include RailsDb::RailsDbDataTableHelper

  test "default rails_db_data_table works" do
    user = User.create(name: 'Igor')
    content = rails_db_data_table('users')
    assert_match /Igor/, content
    assert_no_match /BOB MARLEY/, content
  end

  test "default rails_db_data_table_sql works" do
    user = User.create(name: 'Igor')
    content = rails_db_data_table_sql('select * from users')
    assert_match /Igor/, content
    assert_no_match /BOB MARLEY/, content
  end

  test "rails_db_data_table works with many options" do
    user = User.create(name: 'Igor', age: 9999)
    content = rails_db_data_table('users', limit: 10, order_by: :id, order: :asc, header: false, footer: true, style: :bootstrap, columns: [:id, :name])
    assert_match /Igor/, content
    assert_no_match /BOB MARLEY/, content
    assert_no_match /9999/, content
  end

  test "rails_db_data_table_sql works with many options" do
    user = User.create(name: 'Igor')
    content = rails_db_data_table_sql('select * from users', header: false, footer: true, style: :bootstrap)
    assert_match /Igor/, content
    assert_no_match /BOB MARLEY/, content
  end

end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
rails_db-2.4.0 test/rails_db_data_table_helper_test.rb
rails_db-2.3.1 test/rails_db_data_table_helper_test.rb
rails_db-2.3.0 test/rails_db_data_table_helper_test.rb
rails_db-2.2.1 test/rails_db_data_table_helper_test.rb
rails_db-2.2.0 test/rails_db_data_table_helper_test.rb
rails_db-2.1.1 test/rails_db_data_table_helper_test.rb
rails_db-2.1.0 test/rails_db_data_table_helper_test.rb
rails_db-2.0.6 test/rails_db_data_table_helper_test.rb
rails_db-2.0.5 test/rails_db_data_table_helper_test.rb
rails_db-2.0.4 test/rails_db_data_table_helper_test.rb
xplore-0.0.1.alpha test/rails_db_data_table_helper_test.rb
rails_db-2.0.3 test/rails_db_data_table_helper_test.rb
rails_db-2.0.2 test/rails_db_data_table_helper_test.rb
rails_db-2.0.1 test/rails_db_data_table_helper_test.rb
rails_db-2.0.0 test/rails_db_data_table_helper_test.rb