Sha256: e16f6b995f04ff37a6e8556a597d33d5494d45745d1921ff09b33cd4952f2269

Contents?: true

Size: 1.81 KB

Versions: 17

Compression:

Stored size: 1.81 KB

Contents

require "test_helper"

class FiltersTest < ActiveSupport::TestCase

  include Typus::Controller::Filters

  context "add_predefined_filter" do

    should "work without args" do
      add_predefined_filter()
      assert @predefined_filters.empty?
    end

    should "work with args" do
      add_predefined_filter("something")
      assert_equal [["something"]], @predefined_filters
    end

  end

  context "prepend_predefined_filter" do

    should "work without args" do
      prepend_predefined_filter()
      assert @predefined_filters.empty?
    end

    should "work with args" do
      prepend_predefined_filter("something")
      assert_equal [["something"]], @predefined_filters
    end

    should "work prepending an action without args" do
      add_predefined_filter("something")
      prepend_predefined_filter()
      assert_equal [["something"]], @predefined_filters
    end

    should "work prepending an action with args" do
      add_predefined_filter("something")
      prepend_predefined_filter("something_else")
      assert_equal [["something_else"], ["something"]], @predefined_filters
    end

  end

  context "append_predefined_filter" do

    should "work without args" do
      append_predefined_filter()
      assert @predefined_filters.empty?
    end

    should "work with args" do
      append_predefined_filter("something")
      assert_equal [["something"]], @predefined_filters
    end

    should "work appending an action without args" do
      add_predefined_filter("something")
      append_predefined_filter()
      assert_equal [["something"]], @predefined_filters
    end

    should "work appending an action with args" do
      add_predefined_filter("something")
      append_predefined_filter("something_else")
      assert_equal [["something"], ["something_else"]], @predefined_filters
    end

  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
typus-3.0.11 test/lib/typus/controller/filters_test.rb
typus-3.0.11.rc5 test/lib/typus/controller/filters_test.rb
typus-3.0.11.rc4 test/lib/typus/controller/filters_test.rb
typus-3.0.11.rc3 test/lib/typus/controller/filters_test.rb
typus-3.1.0.rc7 test/lib/typus/controller/filters_test.rb
typus-3.1.0.rc6 test/lib/typus/controller/filters_test.rb
typus-3.1.0.rc5 test/lib/typus/controller/filters_test.rb
typus-3.1.0.rc4 test/lib/typus/controller/filters_test.rb
typus-3.1.0.rc3 test/lib/typus/controller/filters_test.rb
typus-3.1.0.rc2 test/lib/typus/controller/filters_test.rb
typus-3.0.11.rc2 test/lib/typus/controller/filters_test.rb
typus-3.0.11.rc1 test/lib/typus/controller/filters_test.rb
typus-3.1.0.rc1 test/lib/typus/controller/filters_test.rb
typus-3.0.10 test/lib/typus/controller/filters_test.rb
typus-3.0.9 test/lib/typus/controller/filters_test.rb
typus-3.0.8 test/lib/typus/controller/filters_test.rb
typus-3.0.7 test/lib/typus/controller/filters_test.rb