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.3"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.actionObject (readonly)

Returns the value of attribute action.



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

def action
  @action
end

Class Method Details

.deprecateObject



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

def deprecate
  @action = :deprecation_warning
end

.deprecated?Boolean



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

def deprecated?
  @action == :deprecation_warning
end

.ignoreObject



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

def ignore
  @action = nil
end

.raise_exceptionObject



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

def raise_exception
  @action = :raise_exceptioon
end

.raise_exception?Boolean



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

def raise_exception?
  @action == :raise_exceptioon
end

Instance Method Details

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



82
83
84
85
86
# File 'lib/controller/testing/kwargs.rb', line 82

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