Sha256: 81eeb1933ee5c6481780a1c114813b6ba7be9d2af2fe067cc79a49d180621e1f

Contents?: true

Size: 1.77 KB

Versions: 121

Compression:

Stored size: 1.77 KB

Contents

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

class ActionLinkTest < Test::Unit::TestCase
  def setup
    @link = ActiveScaffold::DataStructures::ActionLink.new('foo')
  end

  def test_simple_attributes
    assert_equal 'foo', @link.action
    @link.action = 'bar'
    assert_equal 'bar', @link.action

    hash = {:a => :b}
    @link.parameters = hash
    assert_equal hash, @link.parameters

    @link.label = 'hello world'
    assert_equal 'hello world', @link.label

    assert !@link.confirm
    @link.confirm = true
    assert @link.confirm

    assert_equal 'bar_authorized?', @link.security_method

    assert_equal false, @link.security_method_set?
    @link.security_method = 'blueberry_pie'
    assert_equal true, @link.security_method_set?
    assert_equal 'blueberry_pie', @link.security_method

    @link.type = :collection
    assert_equal :collection, @link.type
    @link.type = :member
    assert_equal :member, @link.type

    assert_equal :get, @link.method
    @link.method = :put
    assert_equal :put, @link.method
  end

  def test_position
    @link.position = true

    @link.type = :collection
    assert_equal :top, @link.position

    @link.type = :member
    assert_equal :replace, @link.position

    @link.position = :before
    assert_equal :before, @link.position

    @link.position = false
    assert_equal false, @link.position
  end

  def test_presentation_style
    # default
    assert @link.inline?
    assert !@link.popup?
    assert !@link.page?

    @link.popup = true
    assert !@link.inline?
    assert @link.popup?
    assert !@link.page?

    @link.page = true
    assert !@link.inline?
    assert !@link.popup?
    assert @link.page?

    @link.inline = true
    assert @link.inline?
    assert !@link.popup?
    assert !@link.page?
  end
end

Version data entries

121 entries across 121 versions & 6 rubygems

Version Path
active_scaffold_vho-4.0.0 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.14 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.13 test/data_structures/action_link_test.rb
active_scaffold-sequel-0.8.0 test/data_structures/action_link_test.rb
active_scaffold-sequel-0.7.1 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.12 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.11 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.10 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.9 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.8 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.7 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.6 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.5 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.4 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.3 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.2 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.1 test/data_structures/action_link_test.rb
active_scaffold-sequel-0.7.0 test/data_structures/action_link_test.rb
active_scaffold_vho-3.2.0 test/data_structures/action_link_test.rb
active_scaffold_vho-3.0.31 test/data_structures/action_link_test.rb