Module: Ww::Double::Mock

Defined in:
lib/ww/double/mock.rb,
lib/ww/double/mock/expectation.rb

Defined Under Namespace

Classes: Expectation

Instance Method Summary collapse

Instance Method Details

#expectationsObject



22
23
24
# File 'lib/ww/double/mock.rb', line 22

def expectations
  @expectations ||= []
end

#mock(args = nil, &block) ⇒ Object



14
15
16
# File 'lib/ww/double/mock.rb', line 14

def mock(args = nil, &block)
  Dsl::MockDefinition.new(self, args, &block)
end

#testing_threadObject



10
11
12
# File 'lib/ww/double/mock.rb', line 10

def testing_thread
  @testing_thread
end

#testing_thread=(thread) ⇒ Object



6
7
8
# File 'lib/ww/double/mock.rb', line 6

def testing_thread=(thread)
  @testing_thread = thread
end

#verifyObject

Raises:



18
19
20
# File 'lib/ww/double/mock.rb', line 18

def verify
  raise MockError unless expectations.all? {|mock| mock.executed? }
end