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_module.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

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, HaveComment, HaveContent, HaveMethod, HaveModule, HaveRegion, 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



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

def have_args_method(method, options = {})
  HaveMethod.new(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, options = {}) ⇒ Object



66
67
68
# File 'lib/code_spec/matchers/have_call.rb', line 66

def have_call(method, options = {})
  HaveCall.new(method, 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_module.rb', line 46

def have_class(klass, postfix = nil)
  HaveClass.new(klass, postfix)
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_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, options = {}) ⇒ Object



70
71
72
# File 'lib/code_spec/matchers/have_call.rb', line 70

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

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



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

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

#have_method(method, type = nil) ⇒ Object



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

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

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



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

def have_module(module_name, postfix=nil)
  HaveModule.new(module_name, postfix)
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



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

def have_subclass(klass, superclass, type=nil)
  HaveSubclass.new(klass, superclass, type)
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