Module: Shoulda::Matchers::ActionController

Defined in:
lib/shoulda/matchers/action_controller/assign_to_matcher.rb

Overview

:nodoc:

Defined Under Namespace

Classes: AssignToMatcher

Instance Method Summary collapse

Instance Method Details

#assign_to(variable) ⇒ Object

Ensures that the controller assigned to the named instance variable.

Options:

  • with_kind_of - The expected class of the instance variable being checked.

  • with - The value that should be assigned.

Example:

it { should assign_to(:user) }
it { should_not assign_to(:user) }
it { should assign_to(:user).with_kind_of(User) }
it { should assign_to(:user).with(@user) }


17
18
19
# File 'lib/shoulda/matchers/action_controller/assign_to_matcher.rb', line 17

def assign_to(variable)
  AssignToMatcher.new(variable)
end