Class: DeclarativeAuthorization::Test::Helpers::AccessTestGenerator

Inherits:
Object
  • Object
show all
Includes:
Blockenspiel::DSL
Defined in:
lib/declarative_authorization/test/helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(test_class) ⇒ AccessTestGenerator

Returns a new instance of AccessTestGenerator.



120
121
122
# File 'lib/declarative_authorization/test/helpers.rb', line 120

def initialize(test_class)
  @test_class = test_class
end

Instance Method Details

#params(name, &block) ⇒ Object



124
125
126
# File 'lib/declarative_authorization/test/helpers.rb', line 124

def params(name, &block)
  @test_class.define_access_test_params_method(name, &block)
end

#role(role, &block) ⇒ Object



128
129
130
131
132
# File 'lib/declarative_authorization/test/helpers.rb', line 128

def role(role, &block)
  raise "Role cannot be blank!" if role.blank?

  Blockenspiel.invoke(block, RoleTestGenerator.new(@test_class, role)) if @test_class.run_role_test?(role)
end