Class: Lita::RSpec::Matchers::Deprecated Deprecated
- Inherits:
-
Object
- Object
- Lita::RSpec::Matchers::Deprecated
- Defined in:
- lib/lita/rspec/matchers/deprecated.rb
Overview
Deprecated.
Will be removed in Lita 5.0. Use the is_expected
forms instead.
Lita 3 versions of the routing matchers.
Instance Method Summary collapse
-
#initialize(context, new_method_name, positive, *args) ⇒ Deprecated
constructor
A new instance of Deprecated.
-
#to(method_name) ⇒ Object
Sets an expectation that the previously supplied message will route to the provided method.
Constructor Details
#initialize(context, new_method_name, positive, *args) ⇒ Deprecated
Returns a new instance of Deprecated.
144 145 146 147 148 149 150 151 152 153 |
# File 'lib/lita/rspec/matchers/deprecated.rb', line 144 def initialize(context, new_method_name, positive, *args) @context = context @new_method_name = new_method_name @expectation_method_name = positive ? :to : :not_to @args = args @context.instance_exec do allow_any_instance_of(Authorization).to receive(:user_in_group?).and_return(true) end end |
Instance Method Details
#to(method_name) ⇒ Object
Sets an expectation that the previously supplied message will route to the provided method.
158 159 160 161 162 163 164 165 166 |
# File 'lib/lita/rspec/matchers/deprecated.rb', line 158 def to(method_name) emn = @expectation_method_name matcher = @context.public_send(@new_method_name, *@args) matcher.to(method_name) @context.instance_exec do is_expected.public_send(emn, matcher) end end |