I have a problem to test message triggering from Controller after dispatching an event. Here is my Rspec test:
describe "product.delete" do it "should trigger any message" do event = create_event("product.delete", :data => "some") expect(event.dispatch).to trigger_message :any end end
Here is my Event.rb file where event routing is specified:
namespace :product do subscribe :delete, :to => ProductController, :with_method => :delete_product end
Then my Controller code:
class ProductController < WebsocketRails::BaseController def delete_product WebsocketRails[:product].trigger :data => "something" end end
And finally here is what I am getting after tests run:
should trigger any message (FAILED - 1) Failures: 1) product.delete should trigger any message Failure/Error: expect(event.dispatch).to trigger_message :any expected product.delete to trigger message with some data, instead it did not trigger any message # ./spec/requests/product.rb:11:in `block (3 levels) in <top (required)>'
I am trying to strictly follow guide on websocket-rails github wiki pages. But definetely there is something I am doing wrong. Can anybody look at my code and advice , please.
Source: New Questions