title: rspec testing a value update using JavaScript and Pusher
body: <p>I have a model called Url and I have a counter in the root page, I update the counter value with javascript (actually coffescript) using pusher.</p>
  
  <p>In my root page I have a javascript that subscribe to a chanel and wait for a message:</p>
  
  <pre><code>pusher = new Pusher(gon.pusher_key)
  channel = pusher.subscribe("url_counter")
  channel.bind "update_url_counter", (data) -&gt;
    $(counter).text(data.urlsCount)
  </code></pre>
  
  <p>Then when I create or delete an url I send a message to pusher with the counter value:</p>
  
  <pre><code>Pusher.trigger("url_counter", "update_url_counter", {urlsCount: Url.all.count})
  </code></pre>
  
  <p>The object in the view which contains the counter is this:</p>
  
  <pre><code>Total urls: &lt;span id="url_counter"&gt;&lt;%=@url_count%&gt;&lt;/span&gt;
  </code></pre>
  
  <p>The thing works fine. But I don't know how to test it.</p>
  
  <p>I hope the information is good enough and somebody can help me.</p>
  
  <p>Thanks in advance.</p>