Module: Muack::API

Defined in:
lib/muack.rb

Class Method Summary collapse

Class Method Details

.allowing(spec) ⇒ Object



81
82
83
# File 'lib/muack.rb', line 81

def allowing spec
  Muack::Allowing.new(spec)
end

.any_instance_of(klass) ⇒ Object



44
45
46
47
# File 'lib/muack.rb', line 44

def any_instance_of klass
  ret = Muack.session.any_instance_of(klass)
  if block_given? then yield(ret) else ret end
end

.anythingObject



49
50
51
# File 'lib/muack.rb', line 49

def anything
  Muack::Anything.new
end

.coat(obj = Object.new) ⇒ Object



34
35
36
37
# File 'lib/muack.rb', line 34

def coat obj=Object.new
  ret = Muack.session.coat(obj)
  if block_given? then yield(ret) else ret end
end

.hash_including(spec) ⇒ Object



101
102
103
104
105
# File 'lib/muack.rb', line 101

def hash_including spec
  $stderr.puts("Muack::API.hash_including is deprecated." \
               " Use Muack::API.having instead.")
  having(spec)
end

.having(spec) ⇒ Object



77
78
79
# File 'lib/muack.rb', line 77

def having spec
  Muack::Having.new(spec)
end

.including(element) ⇒ Object



61
62
63
# File 'lib/muack.rb', line 61

def including element
  Muack::Including.new(element)
end

.is_a(klass) ⇒ Object



53
54
55
# File 'lib/muack.rb', line 53

def is_a klass
  Muack::IsA.new(klass)
end

.match(regexp) ⇒ Object



89
90
91
92
93
# File 'lib/muack.rb', line 89

def match regexp
  $stderr.puts("Muack::API.match is deprecated." \
               " Use Muack::API.matching instead.")
  matching(regexp)
end

.matching(regexp) ⇒ Object



57
58
59
# File 'lib/muack.rb', line 57

def matching regexp
  Muack::Matching.new(regexp)
end

.mock(obj = Object.new) ⇒ Object



24
25
26
27
# File 'lib/muack.rb', line 24

def mock obj=Object.new
  ret = Muack.session.mock(obj)
  if block_given? then yield(ret) else ret end
end

.respond_to(*msg) ⇒ Object



95
96
97
98
99
# File 'lib/muack.rb', line 95

def respond_to *msg
  $stderr.puts("Muack::API.respond_to is deprecated." \
               " Use Muack::API.responding_to instead.")
  responding_to(*msg)
end

.responding_to(*msg) ⇒ Object



69
70
71
# File 'lib/muack.rb', line 69

def responding_to *msg
  Muack::RespondingTo.new(*msg)
end

.satisfy(&block) ⇒ Object



107
108
109
110
111
# File 'lib/muack.rb', line 107

def satisfy &block
  $stderr.puts("Muack::API.satisfy is deprecated." \
               " Use Muack::API.satisfying instead.")
  satisfying(&block)
end

.satisfying(&block) ⇒ Object



85
86
87
# File 'lib/muack.rb', line 85

def satisfying &block
  Muack::Satisfying.new(&block)
end

.spy(obj) ⇒ Object



39
40
41
42
# File 'lib/muack.rb', line 39

def spy obj
  ret = Muack.session.spy(obj)
  if block_given? then yield(ret) else ret end
end

.stub(obj = Object.new) ⇒ Object



29
30
31
32
# File 'lib/muack.rb', line 29

def stub obj=Object.new
  ret = Muack.session.stub(obj)
  if block_given? then yield(ret) else ret end
end

.where(spec) ⇒ Object



73
74
75
# File 'lib/muack.rb', line 73

def where spec
  Muack::Where.new(spec)
end

.within(range_or_array) ⇒ Object



65
66
67
# File 'lib/muack.rb', line 65

def within range_or_array
  Muack::Within.new(range_or_array)
end