Sha256: 24a57ccc33d9ab964e0a982c2e593a8f23405999568b4b479b92436a53bdb80a

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 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

1 entries across 1 versions & 1 rubygems

Version Path
ae_declarative_authorization-0.7.1 test/functional/params_block_arity_test.rb