Permalink
Browse files

Add a chat message scenario for a public channel.

  • Loading branch information...
1 parent c4bde5f commit 95a2056a07502e03cbefceeba280e8f95f901c6e @tristandunn committed Feb 11, 2012
View
@@ -9,6 +9,7 @@ end
group :test do
gem 'bourne', '1.0'
gem 'cucumber-rails', '1.2.1', require: false
+ gem 'pusher', '0.9.2'
gem 'pusher-fake', git: 'git://github.com/tristandunn/pusher-fake.git'
gem 'rspec-rails', '2.8.1'
gem 'shoulda-matchers', '1.0.0'
View
@@ -86,6 +86,10 @@ GEM
multi_json (1.0.4)
nokogiri (1.5.0)
polyglot (0.3.3)
+ pusher (0.9.2)
+ multi_json (~> 1.0)
+ ruby-hmac (~> 0.4.0)
+ signature (~> 0.1.2)
rack (1.4.1)
rack-cache (1.1)
rack (>= 0.4)
@@ -132,6 +136,8 @@ GEM
multi_json (~> 1.0.4)
rubyzip
shoulda-matchers (1.0.0)
+ signature (0.1.2)
+ ruby-hmac
sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
@@ -157,6 +163,7 @@ PLATFORMS
DEPENDENCIES
bourne (= 1.0)
cucumber-rails (= 1.2.1)
+ pusher (= 0.9.2)
pusher-fake!
rails (= 3.2.1)
rspec-rails (= 2.8.1)
View
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2012 Tristan Dunn
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -0,0 +1,46 @@
+# pusher-fake-example
+
+An example of using [pusher-fake](https://github.com/tristandunn/pusher-fake) with Cucumber to test a Rails application.
+
+## How-To
+
+### 1. Set Pusher's WebSocket host and port to PusherFake in your JavaScript.
+
+```erb
+<script>
+<% if defined?(PusherFake) %>
+ Pusher.host = <%== PusherFake.configuration.socket_host.to_json %>;
+ Pusher.ws_port = <%== PusherFake.configuration.socket_port.to_json %>;
+<% end %>
+</script>
+```
+
+### 2. Configure Pusher and PusherFake in your Cucumber environment.
+
+```ruby
+# Use the same API key and secret as the live version.
+PusherFake.configure do |configuration|
+ configuration.key = Pusher.key
+ configuration.secret = Pusher.secret
+end
+
+# Set the host and port to the fake web server.
+Pusher.host = PusherFake.configuration.web_host
+Pusher.port = PusherFake.configuration.web_port
+
+# Start the fake web server.
+Thread.new { PusherFake::Server.start }.tap do |thread|
+ at_exit { thread.exit }
+end
+
+# Reset channels between scenarios.
+After do
+ PusherFake::Channel.reset
+end
+```
+
+### 3. Enjoy testing your Pusher application!
+
+## License
+
+pusher-fake-example uses the MIT license. See LICENSE for more details.
Oops, something went wrong.

0 comments on commit 95a2056

Please sign in to comment.