Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update pusher-fake to 0.6.0.

  • Loading branch information...
commit 72128e78e76d1f97af04f08610dde679f037be61 1 parent f23573d
@tristandunn authored
View
2  Gemfile
@@ -6,6 +6,6 @@ group :test do
gem "bourne", "1.3.0"
gem "cucumber-rails", "1.3.0", require: false
gem "pusher", "0.11.2"
- gem "pusher-fake", "0.5.0"
+ gem "pusher-fake", "0.6.0"
gem "rspec-rails", "2.12.2"
end
View
10 Gemfile.lock
@@ -62,9 +62,9 @@ GEM
http_parser.rb (>= 0.5.3)
em-socksify (0.2.1)
eventmachine (>= 1.0.0.beta.4)
- em-websocket (0.3.8)
- addressable (>= 2.1.1)
+ em-websocket (0.4.0)
eventmachine (>= 0.12.9)
+ http_parser.rb (~> 0.5.3)
erubis (2.7.0)
eventmachine (1.0.0)
ffi (1.3.1)
@@ -89,9 +89,9 @@ GEM
pusher (0.11.2)
multi_json (~> 1.0)
signature (~> 0.1.6)
- pusher-fake (0.5.0)
+ pusher-fake (0.6.0)
em-http-request (= 1.0.3)
- em-websocket (= 0.3.8)
+ em-websocket (= 0.4.0)
multi_json (= 1.5.0)
thin (= 1.5.0)
rack (1.4.4)
@@ -163,6 +163,6 @@ DEPENDENCIES
bourne (= 1.3.0)
cucumber-rails (= 1.3.0)
pusher (= 0.11.2)
- pusher-fake (= 0.5.0)
+ pusher-fake (= 0.6.0)
rails (= 3.2.11)
rspec-rails (= 2.12.2)
View
30 README.markdown
@@ -5,40 +5,18 @@ An example of using [pusher-fake](https://github.com/tristandunn/pusher-fake) wi
## How-To
-### 1. Set Pusher's WebSocket host and port to PusherFake in your JavaScript.
+### 1. Configure the Pusher JS client to use the PusherFake server 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 %>
+ <%== PusherFake.javascript if defined?(PusherFake) %>
</script>
```
-### 2. Configure Pusher and PusherFake in your Cucumber environment.
+### 2. Configure and start PusherFake in your Cucumber environment.
```ruby
-# Use the same API key and secret as the live version.
-PusherFake.configure do |configuration|
- configuration.app_id = Pusher.app_id
- 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.
-fork { PusherFake::Server.start }.tap do |id|
- at_exit { Process.kill("KILL", id) }
-end
-
-# Reset channels between scenarios.
-After do
- PusherFake::Channel.reset
-end
+require "pusher-fake/cucumber"
```
### 3. Enjoy testing your Pusher application!
View
5 app/views/pages/index.html.erb
@@ -3,10 +3,7 @@
<%= javascript_include_tag "pusher-1.12.5" %>
<script>
window.addEventListener("DOMContentLoaded", function() {
- <% if defined?(PusherFake) %>
- Pusher.host = <%== PusherFake.configuration.socket_host.to_json %>;
- Pusher.ws_port = <%== PusherFake.configuration.socket_port.to_json %>;
- <% end %>
+ <%== PusherFake.javascript if defined?(PusherFake) %>
Pusher.instance = new Pusher(<%== Pusher.key.to_json %>);
View
21 features/support/pusher-fake.rb
@@ -1,20 +1 @@
-# Use the same API key and secret as the live version.
-PusherFake.configure do |configuration|
- configuration.app_id = Pusher.app_id
- 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.
-fork { PusherFake::Server.start }.tap do |id|
- at_exit { Process.kill("KILL", id) }
-end
-
-# Reset channels between scenarios.
-After do
- PusherFake::Channel.reset
-end
+require "pusher-fake/cucumber"
Please sign in to comment.
Something went wrong with that request. Please try again.