pusher-fake 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pusher-fake.rb +1 -1
  3. data/lib/pusher-fake/configuration.rb +2 -1
  4. data/lib/pusher-fake/server/application.rb +1 -1
  5. data/spec/features/api/channels_spec.rb +82 -0
  6. data/spec/features/api/users_spec.rb +34 -0
  7. data/spec/features/client/connect_spec.rb +9 -0
  8. data/spec/features/client/event_spec.rb +45 -0
  9. data/spec/features/client/presence_spec.rb +56 -0
  10. data/spec/features/client/subscribe_spec.rb +61 -0
  11. data/spec/features/server/event_spec.rb +120 -0
  12. data/spec/features/server/webhooks_spec.rb +64 -0
  13. data/spec/lib/pusher-fake/channel/presence_spec.rb +36 -30
  14. data/spec/lib/pusher-fake/channel/private_spec.rb +29 -25
  15. data/spec/lib/pusher-fake/channel/public_spec.rb +18 -18
  16. data/spec/lib/pusher-fake/channel_spec.rb +14 -14
  17. data/spec/lib/pusher-fake/configuration_spec.rb +6 -0
  18. data/spec/lib/pusher-fake/connection_spec.rb +38 -36
  19. data/spec/lib/pusher-fake/server/application_spec.rb +70 -70
  20. data/spec/lib/pusher-fake/server_spec.rb +42 -41
  21. data/spec/lib/pusher-fake/webhook_spec.rb +9 -7
  22. data/spec/lib/pusher_fake_spec.rb +5 -4
  23. data/spec/spec_helper.rb +3 -1
  24. data/{features → spec}/support/application.rb +0 -0
  25. data/{features/support/application/public/javascripts/vendor/pusher-2.2.2.js → spec/support/application/public/javascripts/vendor/pusher-2.2.4.js} +26 -19
  26. data/spec/support/application/views/index.erb +83 -0
  27. data/spec/support/capybara.rb +10 -0
  28. data/spec/support/coveralls.rb +0 -1
  29. data/spec/support/helpers/connect.rb +21 -0
  30. data/spec/support/helpers/event.rb +9 -0
  31. data/spec/support/helpers/subscription.rb +29 -0
  32. data/spec/support/helpers/user.rb +11 -0
  33. data/spec/support/{have_configuration_option_matcher.rb → matchers/have_configuration_option.rb} +0 -0
  34. data/spec/support/pusher-fake.rb +15 -0
  35. data/{features → spec}/support/webhooks.rb +5 -1
  36. metadata +51 -101
  37. data/features/channel.feature +0 -109
  38. data/features/channel_presence.feature +0 -27
  39. data/features/channel_subscribe.feature +0 -33
  40. data/features/channel_trigger.feature +0 -91
  41. data/features/channel_webhooks.feature +0 -40
  42. data/features/client_connect.feature +0 -8
  43. data/features/step_definitions/api_steps.rb +0 -40
  44. data/features/step_definitions/channel_steps.rb +0 -86
  45. data/features/step_definitions/client_steps.rb +0 -23
  46. data/features/step_definitions/event_steps.rb +0 -56
  47. data/features/step_definitions/navigation_steps.rb +0 -3
  48. data/features/step_definitions/presence_steps.rb +0 -6
  49. data/features/step_definitions/webhook_steps.rb +0 -21
  50. data/features/support/application/views/index.erb +0 -35
  51. data/features/support/coveralls.rb +0 -1
  52. data/features/support/environment.rb +0 -13
  53. data/features/support/pusher-fake.rb +0 -11
  54. data/features/support/timing.rb +0 -15
  55. data/features/user.feature +0 -14
@@ -1,35 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>PusherFake Test Application</title>
5
- </head>
6
- <body>
7
-
8
- <section>
9
- <header>
10
- <h1><span>0</span> Clients</h1>
11
- </header>
12
-
13
- <ul></ul>
14
- </section>
15
-
16
- <script src="/javascripts/vendor/pusher-2.2.2.js"></script>
17
- <script>
18
- window.addEventListener("DOMContentLoaded", function() {
19
- // Create the client instance using the PusherFake server.
20
- Pusher.instance = <%= PusherFake.javascript %>;
21
- Pusher.instance.events = {};
22
-
23
- // Record all events.
24
- Pusher.instance.connection.bind("message", function(message) {
25
- var events = Pusher.instance.events,
26
- namespace = [message.channel, message.event].join(":");
27
-
28
- events[namespace] || (events[namespace] = []);
29
- events[namespace].push(message.data);
30
- });
31
- }, false);
32
- </script>
33
-
34
- </body>
35
- </html>
@@ -1 +0,0 @@
1
- require "./spec/support/coveralls"
@@ -1,13 +0,0 @@
1
- require "bundler/setup"
2
- require "capybara/cucumber"
3
-
4
- Bundler.require(:default, :development)
5
-
6
- Capybara.app = Sinatra::Application
7
- Capybara.javascript_driver = :webkit
8
-
9
- RSpec.configure do |config|
10
- config.expect_with :rspec do |rspec|
11
- rspec.syntax = :expect
12
- end
13
- end
@@ -1,11 +0,0 @@
1
- PusherFake.configuration.web_options.tap do |options|
2
- Pusher.url = "http://PUSHER_API_KEY:PUSHER_API_SECRET@#{options[:host]}:#{options[:port]}/apps/PUSHER_APP_ID"
3
- end
4
-
5
- Thread.new { PusherFake::Server.start }.tap do |thread|
6
- at_exit { thread.exit }
7
- end
8
-
9
- After do
10
- PusherFake::Channel.reset
11
- end
@@ -1,15 +0,0 @@
1
- module Capybara
2
- module Timing
3
- def wait(seconds = 0.25, &block)
4
- sleep(seconds) && yield
5
- end
6
-
7
- def timeout_after(seconds, &block)
8
- Timeout::timeout(seconds) do
9
- sleep(0.05) until yield
10
- end
11
- end
12
- end
13
- end
14
-
15
- World(Capybara::Timing)
@@ -1,14 +0,0 @@
1
- @javascript
2
- Feature: Requesting user information
3
-
4
- Scenario: Requesting users for a channel
5
- Given I am connected
6
- And Bob is connected
7
- When I request "/channels/public-1/users"
8
- Then I should receive JSON for 0 users
9
- When I subscribe to the "public-1" channel
10
- And I request "/channels/public-1/users"
11
- Then I should receive JSON for 1 user
12
- When Bob is subscribed to the "public-1" channel
13
- And I request "/channels/public-1/users"
14
- Then I should receive JSON for 2 users