Module: ActiveMessaging::TestHelper
- Defined in:
- lib/activemessaging/test_helper.rb
Instance Method Summary collapse
- #assert_has_messages(destination) ⇒ Object
- #assert_message(destination, body) ⇒ Object
- #assert_no_message_with(destination, body) ⇒ Object
- #assert_no_messages(destination) ⇒ Object
- #assert_not_subscribed(destination) ⇒ Object
- #assert_subscribed(destination) ⇒ Object
-
#mock_publish(destination, body, publisher = nil, headers = {}) ⇒ Object
def setup_with_a13g ActiveMessaging.reload_activemessaging end.
Instance Method Details
#assert_has_messages(destination) ⇒ Object
169 170 171 172 173 174 175 176 177 178 |
# File 'lib/activemessaging/test_helper.rb', line 169 def destination destination_name = ActiveMessaging::Gateway.find_destination(destination).value = " No messages for \#{destination_name}.\n All messages:\n \#{ActiveMessaging::Gateway.connection('default').all_messages.inspect}\n EOF\n destination = ActiveMessaging::Gateway.connection('default').find_destination destination_name\n assert !destination.nil? && !destination.messages.empty?, error_message\nend\n" |
#assert_message(destination, body) ⇒ Object
119 120 121 122 123 124 125 126 127 |
# File 'lib/activemessaging/test_helper.rb', line 119 def destination, body destination = ActiveMessaging::Gateway.find_destination(destination).value = " Message for '\#{destination}' with '\#{body}' is not present.\n Messages:\n \#{ActiveMessaging::Gateway.connection('default').all_messages.inspect}\n EOF\n assert ActiveMessaging::Gateway.connection.find_message(destination, body), error_message\nend\n" |
#assert_no_message_with(destination, body) ⇒ Object
129 130 131 132 133 134 135 136 137 |
# File 'lib/activemessaging/test_helper.rb', line 129 def destination, body destination = ActiveMessaging::Gateway.find_destination(destination).value = " Message for '\#{destination}' with '\#{body}' is present.\n Messages:\n \#{ActiveMessaging::Gateway.connection('default').all_messages.inspect}\n EOF\n assert_nil ActiveMessaging::Gateway.connection('default').find_message(destination, body), error_message\nend\n" |
#assert_no_messages(destination) ⇒ Object
139 140 141 142 143 144 145 146 147 |
# File 'lib/activemessaging/test_helper.rb', line 139 def destination destination = ActiveMessaging::Gateway.find_destination(destination).value = " Expected no messages.\n Messages:\n \#{ActiveMessaging::Gateway.connection('default').all_messages.inspect}\n EOF\n assert_equal [], ActiveMessaging::Gateway.connection('default').all_messages, error_message\nend\n" |
#assert_not_subscribed(destination) ⇒ Object
159 160 161 162 163 164 165 166 167 |
# File 'lib/activemessaging/test_helper.rb', line 159 def assert_not_subscribed destination destination = ActiveMessaging::Gateway.find_destination(destination).value = " Subscribed to \#{destination}.\n Subscriptions:\n \#{ActiveMessaging::Gateway.connection('default').subscriptions.inspect}\n EOF\n assert_nil ActiveMessaging::Gateway.connection('default').find_subscription(destination), error_message\nend\n" |
#assert_subscribed(destination) ⇒ Object
149 150 151 152 153 154 155 156 157 |
# File 'lib/activemessaging/test_helper.rb', line 149 def assert_subscribed destination destination = ActiveMessaging::Gateway.find_destination(destination).value = " Not subscribed to \#{destination}.\n Subscriptions:\n \#{ActiveMessaging::Gateway.connection('default').subscriptions.inspect}\n EOF\n assert ActiveMessaging::Gateway.connection('default').find_subscription(destination), error_message\nend\n" |
#mock_publish(destination, body, publisher = nil, headers = {}) ⇒ Object
def setup_with_a13g
ActiveMessaging.reload_activemessaging
end
def teardown_with_a13g
ActiveMessaging::Gateway.reset
end
115 116 117 |
# File 'lib/activemessaging/test_helper.rb', line 115 def mock_publish destination, body, publisher=nil, headers={} ActiveMessaging::Gateway.publish destination, body, publisher, headers end |