<commit_before>require "test_helper"

class ActionsTest < ActiveSupport::TestCase

  include Typus::Actions

  context "add_resource_action" do

    should "work" do
      output = add_resource_action("something")
      expected = [["something"]]

      assert_equal expected, @resource_actions
    end

    should "work when no params are set" do
      add_resource_action()
      assert_equal [], @resource_actions
    end

  end

  context "prepend_resource_action" do

    should "work without args" do
      prepend_resource_action()
      assert_equal [], @resource_actions
    end

    should "work with args" do
      prepend_resource_action("something")
      assert_equal [["something"]], @resource_actions
    end

    should "work prepending an action without args" do
      add_resource_action("something")
      prepend_resource_action()
      assert_equal [["something"]], @resource_actions
    end

    should "work prepending an action with args" do
      add_resource_action("something")
      prepend_resource_action("something_else")
      assert_equal [["something_else"], ["something"]], @resource_actions
    end

  end

  context "append_resource_action" do

    should "work without args" do
      append_resource_action()
      assert_equal [], @resource_actions
    end

    should "work with args" do
      append_resource_action("something")
      assert_equal [["something"]], @resource_actions
    end

    should "work appending an action without args" do
      add_resource_action("something")
      append_resource_action()
      assert_equal [["something"]], @resource_actions
    end

    should "work appending an action with args" do
      add_resource_action("something")
      append_resource_action("something_else")
      assert_equal [["something"], ["something_else"]], @resource_actions
    end

  end

end<commit_msg>I should improve Typus::Actions stuff to avoid duplication<commit_after>require "test_helper"

class ActionsTest < ActiveSupport::TestCase

  include Typus::Actions

  context "add_resource_action" do

    should "work" do
      output = add_resource_action("something")
      expected = [["something"]]

      assert_equal expected, @resource_actions
    end

    should "work when no params are set" do
      add_resource_action()
      assert_equal [], @resource_actions
    end

  end

  context "prepend_resource_action" do

    should "work without args" do
      prepend_resource_action()
      assert_equal [], @resource_actions
    end

    should "work with args" do
      prepend_resource_action("something")
      assert_equal [["something"]], @resource_actions
    end

    should "work prepending an action without args" do
      add_resource_action("something")
      prepend_resource_action()
      assert_equal [["something"]], @resource_actions
    end

    should "work prepending an action with args" do
      add_resource_action("something")
      prepend_resource_action("something_else")
      assert_equal [["something_else"], ["something"]], @resource_actions
    end

  end

  context "append_resource_action" do

    should "work without args" do
      append_resource_action()
      assert_equal [], @resource_actions
    end

    should "work with args" do
      append_resource_action("something")
      assert_equal [["something"]], @resource_actions
    end

    should "work appending an action without args" do
      add_resource_action("something")
      append_resource_action()
      assert_equal [["something"]], @resource_actions
    end

    should "work appending an action with args" do
      add_resource_action("something")
      append_resource_action("something_else")
      assert_equal [["something"], ["something_else"]], @resource_actions
    end

  end

  # FIXME: Cleanup all test after this line.

  context "add_resources_action" do

    should "work" do
      output = add_resources_action("something")
      expected = [["something"]]

      assert_equal expected, @resources_actions
    end

    should "work when no params are set" do
      add_resources_action()
      assert_equal [], @resources_actions
    end

  end

  context "prepend_resources_action" do

    should "work without args" do
      prepend_resources_action()
      assert_equal [], @resources_actions
    end

    should "work with args" do
      prepend_resources_action("something")
      assert_equal [["something"]], @resources_actions
    end

    should "work prepending an action without args" do
      add_resources_action("something")
      prepend_resources_action()
      assert_equal [["something"]], @resources_actions
    end

    should "work prepending an action with args" do
      add_resources_action("something")
      prepend_resources_action("something_else")
      assert_equal [["something_else"], ["something"]], @resources_actions
    end

  end

  context "append_resources_action" do

    should "work without args" do
      append_resources_action()
      assert_equal [], @resources_actions
    end

    should "work with args" do
      append_resources_action("something")
      assert_equal [["something"]], @resources_actions
    end

    should "work appending an action without args" do
      add_resources_action("something")
      append_resources_action()
      assert_equal [["something"]], @resources_actions
    end

    should "work appending an action with args" do
      add_resources_action("something")
      append_resources_action("something_else")
      assert_equal [["something"], ["something_else"]], @resources_actions
    end

  end

end
{'fraction_non_alphanumeric': 0.0861543972774494, 'fraction_numerical': 0.0, 'mean_word_length': 3.5361494719740048, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1339424', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1484, 'n_words': 422}