shove 0.52 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +63 -0
- data/README.markdown +263 -0
- data/Rakefile +47 -0
- data/bin/shove +128 -106
- data/lib/shove/app.rb +78 -0
- data/lib/shove/app_directory.rb +104 -0
- data/lib/shove/client/callback.rb +24 -0
- data/lib/shove/client/channel.rb +81 -0
- data/lib/shove/client/connection.rb +167 -0
- data/lib/shove/http/channel_context.rb +60 -0
- data/lib/shove/http/client_context.rb +82 -0
- data/lib/shove/http/request.rb +94 -0
- data/lib/shove/http/response.rb +30 -0
- data/lib/shove/protocol.rb +53 -0
- data/lib/shove.rb +60 -78
- data/shove.gemspec +11 -20
- data/spec/app_directory_spec.rb +66 -0
- data/spec/cassettes/should_authorize_oneself.yml +24 -0
- data/spec/cassettes/should_be_able_to_authorize_with_the_server.yml +24 -0
- data/spec/cassettes/should_cancel_a_binding.yml +24 -0
- data/spec/cassettes/should_configure_the_default.yml +24 -0
- data/spec/cassettes/should_configure_the_from_the_previous_test.yml +24 -0
- data/spec/cassettes/should_create_a_channel_context.yml +24 -0
- data/spec/cassettes/should_deny_a_connection.yml +24 -0
- data/spec/cassettes/should_deny_a_control_to_a_client.yml +24 -0
- data/spec/cassettes/should_deny_a_publishing_to_a_client.yml +24 -0
- data/spec/cassettes/should_deny_a_subscriptions_to_a_client.yml +24 -0
- data/spec/cassettes/should_deny_publishing_on_a_channel_context.yml +24 -0
- data/spec/cassettes/should_deny_subscriptions_on_a_channel_context.yml +24 -0
- data/spec/cassettes/should_get_a_set_of_nodes_for_the_network.yml +24 -0
- data/spec/cassettes/should_get_a_subscribe_granted_event.yml +24 -0
- data/spec/cassettes/should_grant_a_connection.yml +24 -0
- data/spec/cassettes/should_grant_a_control_to_a_client.yml +24 -0
- data/spec/cassettes/should_grant_a_publishing_to_a_client.yml +24 -0
- data/spec/cassettes/should_grant_a_subscriptions_to_a_client.yml +24 -0
- data/spec/cassettes/should_grant_publishing_on_a_channel_context.yml +24 -0
- data/spec/cassettes/should_grant_subscriptions_on_a_channel_context.yml +24 -0
- data/spec/cassettes/should_publish.yml +24 -0
- data/spec/cassettes/should_publish_on_a_channel_context.yml +24 -0
- data/spec/cassettes/should_publish_to_a_client.yml +24 -0
- data/spec/cassettes/should_receive_an_unsubscribe_event.yml +24 -0
- data/spec/cassettes/should_receive_messages_on_a_channel.yml +24 -0
- data/spec/cassettes/should_send_a_connect_op.yml +24 -0
- data/spec/cassettes/should_send_a_connect_op_with_an_id.yml +24 -0
- data/spec/cassettes/should_spawn_a_client.yml +24 -0
- data/spec/cassettes/should_subscribe_to_a_channel.yml +24 -0
- data/spec/cassettes/should_trigger_a_connect_denied_event.yml +24 -0
- data/spec/cassettes/should_trigger_a_connect_event.yml +24 -0
- data/spec/cassettes/should_trigger_a_disconnect_event.yml +24 -0
- data/spec/cassettes/should_trigger_an_error_event.yml +24 -0
- data/spec/cassettes/should_unsubscribe_from_a_channel.yml +24 -0
- data/spec/cassettes/should_update_the_default_app.yml +24 -0
- data/spec/helper.rb +60 -0
- data/spec/shove_client_spec.rb +194 -0
- data/spec/shove_http_spec.rb +142 -0
- metadata +111 -81
- data/README.md +0 -71
- data/lib/shove/client.rb +0 -54
- data/lib/shove/request.rb +0 -80
- data/lib/shove/response.rb +0 -23
- data/spec/shove_spec.rb +0 -40
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/grant_connect?client=dan
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '32'
|
21
|
+
body: ! '{"code":"200 Ok","details":"Ok"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/grant_control?client=dan
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '36'
|
21
|
+
body: ! '{"code":"400","error":"Invalid URL"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/grant_publish?channel=channel&client=dan
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '32'
|
21
|
+
body: ! '{"code":"200 Ok","details":"Ok"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/grant_subscribe?channel=channel&client=dan
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '32'
|
21
|
+
body: ! '{"code":"200 Ok","details":"Ok"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/grant_publish?channel=test&client=dan
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '32'
|
21
|
+
body: ! '{"code":"200 Ok","details":"Ok"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/grant_subscribe?channel=test&client=dan
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '32'
|
21
|
+
body: ! '{"code":"200 Ok","details":"Ok"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/publish?channel=test
|
6
|
+
body: hi
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '32'
|
21
|
+
body: ! '{"code":"200 Ok","details":"Ok"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/publish?channel=direct:dan
|
6
|
+
body: hi
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '32'
|
21
|
+
body: ! '{"code":"200 Ok","details":"Ok"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://:test@api.shove.dev:8080/apps/test/hosts
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '19'
|
21
|
+
body: ! '["test-1","test-2"]'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 01:53:24 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api.shove.dev:8080/apps/test/validate
|
6
|
+
body: ''
|
7
|
+
headers:
|
8
|
+
Accept:
|
9
|
+
- ! '*/*'
|
10
|
+
User-Agent:
|
11
|
+
- Ruby
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: Ok
|
16
|
+
headers:
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=UTF-8
|
19
|
+
Content-Length:
|
20
|
+
- '39'
|
21
|
+
body: ! '{"code":"503","error":"Not Authorized"}'
|
22
|
+
http_version: !!null
|
23
|
+
recorded_at: Fri, 17 Feb 2012 02:45:34 GMT
|
24
|
+
recorded_with: VCR 2.0.0.rc1
|
data/spec/helper.rb
CHANGED
@@ -1,3 +1,63 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__) + "/../lib/")
|
2
2
|
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler/setup"
|
5
|
+
|
3
6
|
require "shove"
|
7
|
+
require "vcr"
|
8
|
+
|
9
|
+
if ENV["DEBUG"]
|
10
|
+
require "net-http-spy"
|
11
|
+
Net::HTTP.http_logger_options = {:trace => true, :verbose => true}
|
12
|
+
end
|
13
|
+
|
14
|
+
ENV["SHOVE_ENV"] = "development"
|
15
|
+
|
16
|
+
VCR.configure do |c|
|
17
|
+
c.cassette_library_dir = 'spec/cassettes'
|
18
|
+
c.hook_into :webmock
|
19
|
+
c.configure_rspec_metadata!
|
20
|
+
end
|
21
|
+
|
22
|
+
RSpec.configure do |c|
|
23
|
+
# so we can use `:vcr` rather than `:vcr => true`;
|
24
|
+
# in RSpec 3 this will no longer be necessary.
|
25
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
26
|
+
end
|
27
|
+
|
28
|
+
# Queue for goodies
|
29
|
+
$queue = []
|
30
|
+
|
31
|
+
# Backdoor for sending data into the clients
|
32
|
+
# processing code...
|
33
|
+
$backdoor = nil
|
34
|
+
def backdoor message
|
35
|
+
$backdoor.call(Yajl::Encoder.encode(message))
|
36
|
+
end
|
37
|
+
|
38
|
+
# Mock Mock
|
39
|
+
module EM
|
40
|
+
class WebSocketClient
|
41
|
+
|
42
|
+
def initialize url, origin=nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def connect
|
46
|
+
end
|
47
|
+
|
48
|
+
def onopen &block
|
49
|
+
@onopen = block
|
50
|
+
end
|
51
|
+
|
52
|
+
def onmessage &block
|
53
|
+
@onmessage = block
|
54
|
+
$backdoor = block
|
55
|
+
@onopen.call # called
|
56
|
+
end
|
57
|
+
|
58
|
+
def send_data data
|
59
|
+
$queue << Yajl::Parser.parse(data)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|