Class: RSpec::RubyContentMatchers::HaveMethod

Inherits:
RSpec::RubyContentMatcher show all
Defined in:
lib/code_spec/matchers/have_method.rb

Constant Summary

Constants inherited from RSpec::RubyContentMatcher

RSpec::RubyContentMatcher::ANY_GROUP, RSpec::RubyContentMatcher::LPAR, RSpec::RubyContentMatcher::OPT_ARGS, RSpec::RubyContentMatcher::OPT_SPACES, RSpec::RubyContentMatcher::Q_ANY_GROUP, RSpec::RubyContentMatcher::RPAR, RSpec::RubyContentMatcher::SPACES

Instance Attribute Summary collapse

Attributes inherited from RSpec::RubyContentMatcher

#content, #content_matches, #end_option

Instance Method Summary collapse

Methods inherited from RSpec::RubyContentMatcher

#any_args_expr, #args_msg, #comment_end, #debug, #debug?, #debug_content, #display, #display_content, #end_expr, #get_expr, #handle_result, #indexes, #is_match?, #matches?, #opt

Constructor Details

#initialize(method, type = nil, options = {}) ⇒ HaveMethod

Returns a new instance of HaveMethod.



12
13
14
15
16
17
# File 'lib/code_spec/matchers/have_method.rb', line 12

def initialize(method, type=nil, options = {})
  @method = method.to_s
  super method
  @type = type      
  @args = options[:args]
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



10
11
12
# File 'lib/code_spec/matchers/have_method.rb', line 10

def args
  @args
end

#methodObject (readonly)

Returns the value of attribute method.



10
11
12
# File 'lib/code_spec/matchers/have_method.rb', line 10

def method
  @method
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/code_spec/matchers/have_method.rb', line 10

def type
  @type
end

Instance Method Details

#failure_messageObject



23
24
25
26
# File 'lib/code_spec/matchers/have_method.rb', line 23

def failure_message
  super
  display "Expected there to be the #{class_msg} method #{method}, but there wasn't"
end

#indexObject



19
20
21
# File 'lib/code_spec/matchers/have_method.rb', line 19

def index
  1
end

#negative_failure_messageObject



28
29
30
31
# File 'lib/code_spec/matchers/have_method.rb', line 28

def negative_failure_message                                      
  super
  display "Did not expect there to be the #{class_msg} method #{method}, but there was"
end