<commit_before>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

    @link.label = 'Hello World'
    assert_equal 'hello_world_authorized?', @link.security_method
    @link.label = 'HelloWorld'
    assert_equal 'hello_world_authorized?', @link.security_method
    @link.security_method = 'blueberry_pie'
    assert_equal 'blueberry_pie', @link.security_method

    @link.type = :table
    assert_equal :table, @link.type
    @link.type = :record
    assert_equal :record, @link.type

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

  def test_position
    @link.position = true

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

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

    @link.position = :before<commit_msg>fix action link test<commit_after>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
    @link.security_method = 'blueberry_pie'
    assert_equal 'blueberry_pie', @link.security_method

    @link.type = :table
    assert_equal :table, @link.type
    @link.type = :record
    assert_equal :record, @link.type

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

  def test_position
    @link.position = true

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

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

    @link.position = :before
{'fraction_non_alphanumeric': 0.12171837708830549, 'fraction_numerical': 0.0, 'mean_word_length': 3.467140319715808, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6600777', 'n_tokens_mistral': 825, 'n_tokens_neox': 800, 'n_words': 180}