Class: RSpec::RubyContentMatchers::InheritFrom

Inherits:
RSpec::RubyContentMatcher show all
Defined in:
lib/code_spec/matchers/inherit_from.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

#alt_end, #content, #content_matches, #end_option

Instance Method Summary collapse

Methods inherited from RSpec::RubyContentMatcher

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

Constructor Details

#initialize(klass) ⇒ InheritFrom

Returns a new instance of InheritFrom.



5
6
7
8
# File 'lib/code_spec/matchers/inherit_from.rb', line 5

def initialize klass
  @klass = klass.to_s.camelize
  super @klass
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



3
4
5
# File 'lib/code_spec/matchers/inherit_from.rb', line 3

def klass
  @klass
end

Instance Method Details

#failure_messageObject



14
15
16
17
# File 'lib/code_spec/matchers/inherit_from.rb', line 14

def failure_message
  super
  "Expected the class to inherit from #{klass}"
end

#indexObject



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

def index
  1
end

#negative_failure_messageObject



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

def negative_failure_message
  super
  "Did not expect the class to inherit from #{klass}"
end