Sha256: 32c5d07c37478d73f79673353bc12eb14788d79fc77e32db25964cc03283e651

Contents?: true

Size: 737 Bytes

Versions: 11

Compression:

Stored size: 737 Bytes

Contents

require 'test_helper'

class ParamsBlockArityTest < ActionController::TestCase
  include DeclarativeAuthorization::Test::Helpers

  class ParamsBlockArityTestController < ApplicationController

  end

  tests ParamsBlockArityTestController

  access_tests do

    params :less_than_max_arguments do | one |
      { this: :works }
    end

    params :too_many_arguments do | one, two, three |
      { what: :ever }
    end

  end

  def test_params_arity
    assert_raises(InvalidParamsBlockArity) do
      access_test_params(:too_many_arguments)
    end

    assert_equal({ this: :works }, access_test_params(:less_than_max_arguments))
  end

  private

  def access_test_params_for_param_methods
    [:old_user, :new_user]
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ae_declarative_authorization-0.10.1 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.10.0 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.9.2 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.9.1 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.9.0 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.8.0 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.7.0 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.6.0 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.6.0.pre3 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.6.0.pre2 test/functional/params_block_arity_test.rb
ae_declarative_authorization-0.6.0.pre test/functional/params_block_arity_test.rb