Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit 393543efce97936ac7faaf204160fdccea94a517 @tristandunn committed Dec 7, 2011
@@ -0,0 +1 @@
+pkg
@@ -0,0 +1,3 @@
+source "http://rubygems.org"
+
+gemspec
@@ -0,0 +1,97 @@
+PATH
+ remote: .
+ specs:
+ pusher-fake (0.1.0)
+ em-websocket (= 0.3.5)
+ yajl-ruby (= 1.1.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ addressable (2.2.6)
+ bourne (1.0)
+ mocha (= 0.9.8)
+ builder (3.0.0)
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ capybara-webkit (0.7.2)
+ capybara (>= 1.0.0, < 1.2)
+ childprocess (0.2.3)
+ ffi (~> 1.0.6)
+ cucumber (1.1.3)
+ builder (>= 2.1.2)
+ diff-lcs (>= 1.1.2)
+ gherkin (~> 2.6.7)
+ json (>= 1.4.6)
+ term-ansicolor (>= 1.0.6)
+ daemons (1.1.4)
+ diff-lcs (1.1.3)
+ em-websocket (0.3.5)
+ addressable (>= 2.1.1)
+ eventmachine (>= 0.12.9)
+ eventmachine (0.12.10)
+ ffi (1.0.11)
+ gherkin (2.6.9)
+ json (>= 1.4.6)
+ json (1.6.3)
+ mime-types (1.17.2)
+ mocha (0.9.8)
+ rake
+ multi_json (1.0.4)
+ nokogiri (1.5.0)
+ rack (1.3.5)
+ rack-protection (1.1.4)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rake (0.9.2.2)
+ redcarpet (2.0.0)
+ rspec (2.7.0)
+ rspec-core (~> 2.7.0)
+ rspec-expectations (~> 2.7.0)
+ rspec-mocks (~> 2.7.0)
+ rspec-core (2.7.1)
+ rspec-expectations (2.7.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.7.0)
+ rubyzip (0.9.5)
+ selenium-webdriver (2.14.0)
+ childprocess (>= 0.2.1)
+ ffi (~> 1.0.9)
+ multi_json (~> 1.0.4)
+ rubyzip
+ sinatra (1.3.1)
+ rack (~> 1.3, >= 1.3.4)
+ rack-protection (~> 1.1, >= 1.1.2)
+ tilt (~> 1.3, >= 1.3.3)
+ term-ansicolor (1.0.7)
+ thin (1.3.1)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ tilt (1.3.3)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
+ yajl-ruby (1.1.0)
+ yard (0.7.4)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bourne (= 1.0.0)
+ bundler (= 1.1.rc)
+ capybara (= 1.1.2)
+ capybara-webkit (= 0.7.2)
+ cucumber (= 1.1.3)
+ pusher-fake!
+ redcarpet (= 2.0.0)
+ rspec (= 2.7.0)
+ sinatra (= 1.3.1)
+ thin (= 1.3.1)
+ yard (= 0.7.4)
21 LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2011 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.
@@ -0,0 +1,7 @@
+# pusher-fake
+
+A fake [Pusher](http://pusher.com) server for development and testing.
+
+## License
+
+pusher-fake uses the MIT license. See LICENSE for more details.
@@ -0,0 +1,21 @@
+require "bundler/setup"
+require "cucumber/rake/task"
+require "rspec/core/rake_task"
+require "yard"
+
+Bundler::GemHelper.install_tasks
+
+Cucumber::Rake::Task.new do |t|
+ t.cucumber_opts = %w{--format progress --strict}
+end
+
+RSpec::Core::RakeTask.new do |t|
+ t.pattern = "spec/**/*_spec.rb"
+end
+
+YARD::Rake::YardocTask.new do |t|
+ t.files = ["lib/**/*.rb"]
+ t.options = ["--no-private"]
+end
+
+task default: [:spec, :cucumber]
@@ -0,0 +1,11 @@
+@javascript
+Feature: Client connecting to the server
+
+ Scenario: Client connects to the server
+ Given I am on the homepage
+ Then I should be connected
+
+ @disable-server
+ Scenario: Client unsuccessfully connects to the server
+ Given I am on the homepage
+ Then I should not be connected
@@ -0,0 +1,13 @@
+Then "I should be connected" do
+ wait_until(2) do
+ state = page.evaluate_script("Pusher.instance.connection.state")
+ state == "connected"
+ end
+end
+
+Then "I should not be connected" do
+ wait_until(2) do
+ state = page.evaluate_script("Pusher.instance.connection.state")
+ state == "unavailable"
+ end
+end
@@ -0,0 +1,3 @@
+Given "I am on the homepage" do
+ visit "/"
+end
@@ -0,0 +1,13 @@
+require "sinatra"
+
+class Sinatra::Application
+ set :root, Proc.new { File.join(File.dirname(__FILE__), "application") }
+ set :views, Proc.new { File.join(root, "views") }
+ set :public_folder, Proc.new { File.join(root, "public") }
+
+ disable :logging
+
+ get "/" do
+ erb :index
+ end
+end
@@ -0,0 +1,7 @@
+window.addEventListener("load", function() {
+ // Create the client instance.
+ Pusher.instance = new Pusher("API_KEY");
+
+ // Force the connection to go unavailable after a single attempt.
+ Pusher.instance.connection.connectionAttempts = 4;
+}, false);
Oops, something went wrong.

0 comments on commit 393543e

Please sign in to comment.