Method: FlexMock#flexmock_define_expectation
- Defined in:
- lib/flexmock/core.rb
#flexmock_define_expectation(location, *args, **kw) ⇒ Object
Using location, define the expectations specified by args.
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/flexmock/core.rb', line 254 def flexmock_define_expectation(location, *args, **kw) @last_expectation = EXP_BUILDER.parse_should_args(self, args, kw) do |method_name| exp = flexmock_expectations_for(method_name) || ExpectationDirector.new(method_name) @expectations[method_name] = exp result = Expectation.new(self, method_name, location) exp << result override_existing_method(method_name) if flexmock_respond_to?(method_name, true) if @base_class && !@base_class.flexmock_defined?(method_name) if !ON_RUBY_20 || !@base_class.ancestors.include?(Class) result = ExplicitNeeded.new(result, method_name, @base_class) end end result end end |