Class: RSpec::Rails::Matchers::Assign::AssignMetaMatcher
- Inherits:
-
Object
- Object
- RSpec::Rails::Matchers::Assign::AssignMetaMatcher
- Defined in:
- lib/rspec/rails/matchers/assign.rb
Overview
nodoc
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(scope, name, matcher) ⇒ AssignMetaMatcher
constructor
A new instance of AssignMetaMatcher.
- #matches?(actual) ⇒ Boolean
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(scope, name, matcher) ⇒ AssignMetaMatcher
Returns a new instance of AssignMetaMatcher.
93 94 95 96 97 |
# File 'lib/rspec/rails/matchers/assign.rb', line 93 def initialize scope, name, matcher @scope = scope @name = name @matcher = matcher end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
108 109 110 |
# File 'lib/rspec/rails/matchers/assign.rb', line 108 def method_missing name, *args, &block @matcher.send name, *args, &block end |
Instance Method Details
#description ⇒ Object
104 105 106 |
# File 'lib/rspec/rails/matchers/assign.rb', line 104 def description "assign @#{@name} to #{@matcher.description}" end |
#matches?(actual) ⇒ Boolean
99 100 101 102 |
# File 'lib/rspec/rails/matchers/assign.rb', line 99 def matches? actual @actual = actual.assigns[@name] @matcher.matches? @actual end |