Sha256: d790087cac2b26684d4d0c7744efddebb6a5e213e79dec0b9738f26a0ad6a3f7

Contents?: true

Size: 1.12 KB

Versions: 65

Compression:

Stored size: 1.12 KB

Contents

require File.join(File.dirname(__FILE__), '../test_helper.rb')

class ListColumnHelpersTest < ActionView::TestCase
  include ActiveScaffold::Helpers::ListColumnHelpers
  include ActiveScaffold::Helpers::ViewHelpers

  def setup
    @column = ActiveScaffold::DataStructures::Column.new(:a, ModelStub)
    @record = stub(:a => 'value_2')
    @config = stub(:list => stub(:empty_field_text => '-'))
  end

  def test_options_for_select_list_ui_for_simple_column
    @column.options[:options] = [:value_1, :value_2, :value_3]
    assert_equal 'Value 2', active_scaffold_column_select(@column, @record)

    @column.options[:options] = %w(value_1 value_2 value_3)
    assert_equal 'value_2', active_scaffold_column_select(@column, @record)

    @column.options[:options] = [%w(text_1 value_1), %w(text_2 value_2), %w(text_3 value_3)]
    assert_equal 'text_2', active_scaffold_column_select(@column, @record)

    @column.options[:options] = [[:text_1, :value_1], [:text_2, :value_2], [:text_3, :value_3]]
    assert_equal 'Text 2', active_scaffold_column_select(@column, @record)
  end

  private
  def active_scaffold_config
    @config
  end
end

Version data entries

65 entries across 65 versions & 4 rubygems

Version Path
active_scaffold_vho-4.0.0 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.14 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.13 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.12 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.11 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.10 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.9 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.8 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.7 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.6 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.5 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.4 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.3 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.2 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.1 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.2.0 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.0.31 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.1.8 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.0.30 test/helpers/list_column_helpers_test.rb
active_scaffold_vho-3.0.29 test/helpers/list_column_helpers_test.rb