Module: EvelpidonTestHelpers::ActionController

Included in:
ActionController::TestCase
Defined in:
lib/evelpidon_test_helpers/action_controller.rb

Instance Method Summary collapse

Instance Method Details

#assert_assigns(instance_variable_name, expected_value = nil) ⇒ Object

Asserts that the controller assigned an instance variable with the given instance_variable_name and optionally checks that it’s ‘is equal with the given expected_value.



5
6
7
8
9
10
# File 'lib/evelpidon_test_helpers/action_controller.rb', line 5

def assert_assigns(instance_variable_name, expected_value = nil)
  assert_not_nil assigns(instance_variable_name), "#{instance_variable_name} was not assigned."
  unless expected_value.nil?
    assert_equal expected_value, assigns(instance_variable_name)
  end
end