Class: MockIntObject

Inherits:
Object show all
Defined in:
lib/extensions/mspec/mspec/mocks/proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val) ⇒ MockIntObject

Returns a new instance of MockIntObject.



28
29
30
31
32
33
34
35
36
# File 'lib/extensions/mspec/mspec/mocks/proxy.rb', line 28

def initialize(val)
  @value = val
  @calls = 0

  key = [self, :to_int]

  Mock.objects[key] = self
  Mock.mocks[key] << self
end

Instance Attribute Details

#callsObject (readonly)

Returns the value of attribute calls.



38
39
40
# File 'lib/extensions/mspec/mspec/mocks/proxy.rb', line 38

def calls
  @calls
end

Instance Method Details

#countObject



45
46
47
# File 'lib/extensions/mspec/mspec/mocks/proxy.rb', line 45

def count
  [:at_least, 1]
end

#to_intObject



40
41
42
43
# File 'lib/extensions/mspec/mspec/mocks/proxy.rb', line 40

def to_int
  @calls += 1
  @value
end