Module: RSpec::RubyContentMatchers

Defined in:
lib/code_spec/matchers/have_call.rb,
lib/code-spec.rb,
lib/code_spec/matchers/have_block.rb,
lib/code_spec/matchers/have_calls.rb,
lib/code_spec/matchers/have_method.rb,
lib/code_spec/matchers/have_region.rb,
lib/code_spec/matchers/match_lines.rb,
lib/code_spec/matchers/have_comment.rb,
lib/code_spec/matchers/have_content.rb,
lib/code_spec/matchers/inherit_from.rb,
lib/code_spec/matchers/have_subclass.rb,
lib/code_spec/matchers/include_module.rb,
lib/code_spec/matchers/have_class_self.rb,
lib/code_spec/matchers/have_class_module.rb,
lib/code_spec/matchers/multi/have_methods.rb,
lib/code_spec/matchers/multi/have_subclasses.rb,
lib/code_spec/matchers/multi/have_classes_modules.rb

Overview

This method tries to see if a specific method is contained in the generated file. It can operate (should) on either a file name or the raw content

generated_file_name.should have_method "hello" # 'my/path/say_hello.rb'.should have_method "hello"

say_hello_file_content.should have_method "hello"

Defined Under Namespace

Classes: HaveBlock, HaveCall, HaveCalls, HaveClass, HaveClassSelf, HaveClasses, HaveComment, HaveContent, HaveMethod, HaveMethods, HaveModule, HaveModules, HaveRegion, HaveSubClasses, HaveSubclass, IncludeModule, InheritFrom, MatchLines

Instance Method Summary collapse

Instance Method Details

#extend_module(module_name) ⇒ Object



31
32
33
# File 'lib/code_spec/matchers/include_module.rb', line 31

def extend_module(module_name)
  IncludeModule.new(module_name, :extend)
end

#have_args_method(method, options = {}) ⇒ Object



65
66
67
# File 'lib/code_spec/matchers/have_method.rb', line 65

def have_args_method(method, options = {})
  have_method method, options[:type], options
end

#have_block(name, options = {}) ⇒ Object



87
88
89
# File 'lib/code_spec/matchers/have_block.rb', line 87

def have_block(name, options={})
  HaveBlock.new(name, options)
end

#have_call(method_name, options = {}) ⇒ Object



86
87
88
# File 'lib/code_spec/matchers/have_call.rb', line 86

def have_call(method_name, options = {})
  HaveCall.new(method_name, options)
end

#have_calls(*calls) ⇒ Object



57
58
59
# File 'lib/code_spec/matchers/have_calls.rb', line 57

def have_calls(*calls)
  HaveCalls.new(*calls)
end

#have_class(klass, postfix = nil) ⇒ Object Also known as: be_class



46
47
48
# File 'lib/code_spec/matchers/have_class_module.rb', line 46

def have_class(klass, postfix = nil)
  HaveClass.new(klass, postfix)
end

#have_class_method(method) ⇒ Object



61
62
63
# File 'lib/code_spec/matchers/have_method.rb', line 61

def have_class_method(method)
  have_method method, :class
end

#have_class_methods(*methods) ⇒ Object



82
83
84
# File 'lib/code_spec/matchers/multi/have_methods.rb', line 82

def have_class_methods *methods
  have_methods *methods, :type => :class
end

#have_class_selfObject



36
37
38
# File 'lib/code_spec/matchers/have_class_self.rb', line 36

def have_class_self
  HaveClassSelf.new
end

#have_classes(*names) ⇒ Object

can take :postfix hash arg



74
75
76
# File 'lib/code_spec/matchers/multi/have_classes_modules.rb', line 74

def have_classes *names
  HaveClasses.new *names
end

#have_comment(comment) ⇒ Object



31
32
33
# File 'lib/code_spec/matchers/have_comment.rb', line 31

def have_comment comment
  HaveComment.new comment
end

#have_contentObject



25
26
27
# File 'lib/code_spec/matchers/have_content.rb', line 25

def have_content
  HaveContent.new
end

#have_dot_call(method_name, options = {}) ⇒ Object



90
91
92
# File 'lib/code_spec/matchers/have_call.rb', line 90

def have_dot_call(method_name, options = {})
  have_call method_name, options.merge(:dot => true)
end

#have_form_call(method_name, options = {}) ⇒ Object



94
95
96
# File 'lib/code_spec/matchers/have_call.rb', line 94

def have_form_call(method_name, options = {})
  have_call method_name, options.merge(:dot => :form)
end

#have_method(method, type = nil) ⇒ Object



57
58
59
# File 'lib/code_spec/matchers/have_method.rb', line 57

def have_method(method, type = nil)
  HaveMethod.new(method, type)
end

#have_methods(*methods) ⇒ Object



78
79
80
# File 'lib/code_spec/matchers/multi/have_methods.rb', line 78

def have_methods *methods
  HaveMethods.new methods
end

#have_module(module_name, postfix = nil) ⇒ Object Also known as: be_module



41
42
43
# File 'lib/code_spec/matchers/have_class_module.rb', line 41

def have_module(module_name, postfix=nil)
  HaveModule.new(module_name, postfix)
end

#have_modules(*names) ⇒ Object

can take :postfix hash arg



69
70
71
# File 'lib/code_spec/matchers/multi/have_classes_modules.rb', line 69

def have_modules *names
  HaveModules.new names
end

#have_privateObject



43
44
45
# File 'lib/code_spec/matchers/have_region.rb', line 43

def have_private
  HaveRegion.new :private
end

#have_protectedObject



39
40
41
# File 'lib/code_spec/matchers/have_region.rb', line 39

def have_protected
  HaveRegion.new :protected
end

#have_publicObject



35
36
37
# File 'lib/code_spec/matchers/have_region.rb', line 35

def have_public
  HaveRegion.new :public
end

#have_region(name) ⇒ Object



31
32
33
# File 'lib/code_spec/matchers/have_region.rb', line 31

def have_region name
  HaveRegion.new name
end

#have_subclass(klass, superclass, type = nil) ⇒ Object Also known as: be_subclass



35
36
37
# File 'lib/code_spec/matchers/have_subclass.rb', line 35

def have_subclass(klass, superclass, type=nil)
  HaveSubclass.new(klass, superclass, type)
end

#have_subclasses(*names) ⇒ Object

can take :postfix and :superclass hash args



32
33
34
# File 'lib/code_spec/matchers/multi/have_subclasses.rb', line 32

def have_subclasses *names
  HaveSubClasses.new *names
end

#include_module(module_name) ⇒ Object



27
28
29
# File 'lib/code_spec/matchers/include_module.rb', line 27

def include_module(module_name)
  IncludeModule.new(module_name)
end

#inherit_from(klass) ⇒ Object Also known as: be_subclass_of



31
32
33
# File 'lib/code_spec/matchers/inherit_from.rb', line 31

def inherit_from(klass)
  InheritFrom.new(klass)
end

#match_lines(*lines) ⇒ Object



38
39
40
# File 'lib/code_spec/matchers/match_lines.rb', line 38

def match_lines *lines
  MatchLines.new lines
end