module FastlyNsq::ProducerTesting
Public Instance Methods
connect()
click to toggle source
Calls superclass method
# File lib/fastly_nsq/testing.rb, line 180 def connect return super unless FastlyNsq::Testing.enabled? @connected = true end
connected?()
click to toggle source
Calls superclass method
# File lib/fastly_nsq/testing.rb, line 145 def connected? return super unless FastlyNsq::Testing.enabled? @connected = true if @connected.nil? @connected end
connection()
click to toggle source
Calls superclass method
# File lib/fastly_nsq/testing.rb, line 174 def connection return super unless FastlyNsq::Testing.enabled? return nil unless connected? self end
messages()
click to toggle source
# File lib/fastly_nsq/testing.rb, line 185 def messages raise NoMethodError unless FastlyNsq::Testing.enabled? FastlyNsq::Messages.messages[topic] end
terminate()
click to toggle source
Calls superclass method
# File lib/fastly_nsq/testing.rb, line 151 def terminate return super unless FastlyNsq::Testing.enabled? @connected = false end
write(message)
click to toggle source
Calls superclass method
# File lib/fastly_nsq/testing.rb, line 157 def write(message) return super unless FastlyNsq::Testing.enabled? raise FastlyNsq::NotConnectedError unless connected? test_message = TestMessage.new(message) FastlyNsq::Messages.messages[topic] << test_message if FastlyNsq::Testing.inline? listener = FastlyNsq.manager.topic_listeners[topic] return unless listener listener.call test_message end true end