# File lib/webmock/request_stub.rb, line 38
38: def response
39: if @responses_sequences.empty?
40: WebMock::Response.new
41: elsif @responses_sequences.length > 1
42: @responses_sequences.shift if @responses_sequences.first.end?
43: @responses_sequences.first.next_response
44: else
45: @responses_sequences[0].next_response
46: end
47: end
# File lib/webmock/request_stub.rb, line 49
49: def then
50: self
51: end
# File lib/webmock/request_stub.rb, line 53
53: def times(number)
54: raise "times(N) accepts integers >= 1 only" if !number.is_a?(Fixnum) || number < 1
55: if @responses_sequences.empty?
56: raise "Invalid WebMock stub declaration." +
57: " times(N) can be declared only after response declaration."
58: end
59: @responses_sequences.last.times_to_repeat += number-1
60: self
61: end
# File lib/webmock/request_stub.rb, line 26
26: def to_raise(*exceptions)
27: @responses_sequences << ResponsesSequence.new([*exceptions].flatten.map {|e|
28: ResponseFactory.response_for(:exception => e)
29: })
30: self
31: end
# File lib/webmock/request_stub.rb, line 17
17: def to_return(*response_hashes, &block)
18: if block
19: @responses_sequences << ResponsesSequence.new([ResponseFactory.response_for(block)])
20: else
21: @responses_sequences << ResponsesSequence.new([*response_hashes].flatten.map {|r| ResponseFactory.response_for(r)})
22: end
23: self
24: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.