Sha256: 3cc6ecf8b11837e28b68badcbb55acf39b84b018e5dc8f584de9292791443948

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'

class RailsDbHelpersTest < ActionView::TestCase
  include RailsDb::Helpers

  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

4 entries across 4 versions & 1 rubygems

Version Path
rails_db-2.4.4 test/rails_db_helpers_test.rb
rails_db-2.4.3 test/rails_db_helpers_test.rb
rails_db-2.4.2 test/rails_db_helpers_test.rb
rails_db-2.4.1 test/rails_db_helpers_test.rb