Sha256: 4e4e678242b0128c3683fe8f6abce838817d74e3b96c47d63427c2dea1ec9667

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class PostsControllerTest < ActionController::TestCase
  test 'should render table' do
    get :index, template: :render

    assert_select 'table#the-id.the-class' do
      assert_select 'thead' do
        assert_select 'tr' do
          assert_select 'th'
        end
      end

      assert_select 'tbody' do
        assert_select 'tr' do
          assert_select 'td.title'
          assert_select 'td.text'
          assert_select 'td.link'
        end
      end
    end
  end

  test 'should render table with defaults' do
    old_defaults = SimpleTableFor::Defaults.get
    SimpleTableFor::Defaults.set({id: 'default-id', class: 'default-class'})

    get :index, template: :defaults

    assert_select 'table#default-id.default-class' do
      assert_select 'thead' do
        assert_select 'tr' do
          assert_select 'th'
        end
      end

      assert_select 'tbody' do
        assert_select 'tr' do
          assert_select 'td'
        end
      end
    end

    SimpleTableFor::Defaults.set old_defaults
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_table_for-0.1.1 test/dummy/test/controllers/posts_controller_test.rb
simple_table_for-0.1.0 test/dummy/test/controllers/posts_controller_test.rb