Module: Controller::Testing::Kwargs

Defined in:
lib/controller/testing/kwargs.rb,
lib/controller/testing/kwargs/version.rb

Constant Summary collapse

ERROR_MESSAGE =
'Please use Rails 5 syntax. See: https://github.com/appfolio/controller-testing-kwargs'
VERSION =
"1.0.1"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.on_oldObject (readonly)

Returns the value of attribute on_old.



12
13
14
# File 'lib/controller/testing/kwargs.rb', line 12

def on_old
  @on_old
end

Class Method Details

.deprecateObject



14
15
16
# File 'lib/controller/testing/kwargs.rb', line 14

def deprecate
  @on_old = :warn
end

.deprecated?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/controller/testing/kwargs.rb', line 18

def deprecated?
  @on_old == :warn
end

.ignoreObject



22
23
24
# File 'lib/controller/testing/kwargs.rb', line 22

def ignore
  @on_old = :ignore
end

.raise_exceptionObject



26
27
28
# File 'lib/controller/testing/kwargs.rb', line 26

def raise_exception
  @on_old = :raise
end

.raise_exception?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/controller/testing/kwargs.rb', line 30

def raise_exception?
  @on_old == :raise
end

Instance Method Details

#xhr(request_method, action, parameters = nil, *args) ⇒ Object



76
77
78
79
80
# File 'lib/controller/testing/kwargs.rb', line 76

def xhr(request_method, action, parameters = nil, *args)
  raise Exception ERROR_MESSAGE if Controller::Testing::Kwargs.raise_exception?
  ActiveSupport::Deprecation.warn(ERROR_MESSAGE) if Controller::Testing::Kwargs.deprecated?
  super(request_method, action, parameters, *args)
end