Class: RSpec::Rails::Matchers::Assign::AssignMetaMatcher
- Inherits:
-
Object
- Object
- RSpec::Rails::Matchers::Assign::AssignMetaMatcher
show all
- Defined in:
- lib/rspec/rails/matchers/assign.rb
Overview
Instance Method Summary
collapse
Constructor Details
#initialize(scope, name, matcher) ⇒ 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
|