This is the way I tested it.
On one hand I made sure when a url is created Pusher is called correctly
url = "http://test.com"
expect(Pusher).to receive(:trigger).with("urlmini", "update_url_counter", {urlsCount: 1}).and_return {}
visit new_url_path
fill_in "url_text", with: original
click_button "submit_url"
Then to test if my JavaScript is working correctly I call Pusher
visit root_path
within "#url_counter" do
expect(page).to have_content "0"
end
fake_counter = 10
Pusher.trigger("urlmini", "update_url_counter", {urlsCount: fake_counter})
within "#url_counter" do
expect(page).to have_content fake_counter
end