Sha256: 20ed939b958eefce9ce95ae94fe57e1bb972d96ebb6cc4d3220f7482661a2fb0

Contents?: true

Size: 1.38 KB

Versions: 15

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'

class TablesHelperTest < ActionView::TestCase
  include RailsDb::TablesHelper

  def setup
    clean_db
  end

  test "method column_is_checked? returns true for checkbox status if cookie does not contain hash_key for this table" do
    status = column_is_checked?('users', 'created_at')
    assert_equal true, status
  end

  test "method column_is_checked? returns true for checkbox status if cookie does not contain record for this table:column" do
    cookies['Table: users'] = 'created_at,'
    status = column_is_checked?('users', 'name')
    assert_equal true, status
  end

  test "method column_is_checked? returns false for checkbox status if cookie contains record for this table:column" do
    cookies['Table: users'] = 'created_at,'
    status = column_is_checked?('users', 'created_at')
    assert_equal false, status
  end

  test "method display_style_column returns 'display:none' if cookie contains record for this table:column" do
    cookies['Table: users'] = 'created_at,'
    style = display_style_column('users', 'created_at')
    assert_equal 'display:none', style
  end

  test "method display_style_column returns 'display' if cookie does not contain record for this table:column" do
    cookies['Table: users'] = 'created_at,'
    style = display_style_column('users', 'name')
    assert_equal 'display', style
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rails_db-1.6.0 test/tables_helper_test.rb
rails_db-1.5.0 test/tables_helper_test.rb
rails_db-1.4.1 test/tables_helper_test.rb
rails_db-1.4.0 test/tables_helper_test.rb
rails_db-1.3.4 test/tables_helper_test.rb
rails_db-1.3.3 test/tables_helper_test.rb
rails_db-1.3.2 test/tables_helper_test.rb
rails_db-1.3.1 test/tables_helper_test.rb
rails_db-1.3 test/tables_helper_test.rb
rails_db-1.1.1 test/tables_helper_test.rb
rails_db-1.1 test/tables_helper_test.rb
rails_db-1.0 test/tables_helper_test.rb
rails_db-0.9.9 test/tables_helper_test.rb
rails_db-0.9 test/tables_helper_test.rb
rails_db-0.8 test/tables_helper_test.rb