syro 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/syro.rb +3 -3
  3. data/syro.gemspec +1 -1
  4. data/test/all.rb +24 -0
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c674acd1e5f50201c1a6d8ba682f73376922bf06
4
- data.tar.gz: cf8130872298e53a52b0da3358c8c7929b81ce4b
3
+ metadata.gz: d42da05d9e40f9dd247ca71a2f3b2514fdeedb0a
4
+ data.tar.gz: 6019c98bff4e489bcd0f1f5975dc046a3ab94193
5
5
  SHA512:
6
- metadata.gz: 8fb83225dc60423a43c56147159e679be6349a5da972ba9183b7bcbfe12091c630046c8e0f28d9570609f1bf64e082802c7aac7c42ac56c4025dd796cd0b08b9
7
- data.tar.gz: a9ed177ed81d563450db71b2b30053ee2bf8c11f40dc1df3778de92de71ec7b3606895cc90413aba84af78bdb435c00fbee85483aecabefb2674bb94aec3dc01
6
+ metadata.gz: 52a247d00e9b09cd152a65e8702150e8df91c50f66bc811f7ac94be90ba3dd3e9b93cb016a70474ac4c19005835ad62382c3d920edb49777b991cac7d4ab2106
7
+ data.tar.gz: 15c8260bae6bf88ffbb1882b2c4a9cb50ab97b4d693ba4b98ba2a254d014175c6c1c10d48ec570767039081d76395aefb0f390c96d1b80730d7934e0418aaa37
@@ -123,7 +123,7 @@ class Syro
123
123
  def call(env, inbox)
124
124
  @syro_env = env
125
125
  @syro_req = Rack::Request.new(env)
126
- @syro_res = Syro::Response.new({})
126
+ @syro_res = Syro::Response.new
127
127
  @syro_path = Seg.new(env.fetch(Syro::PATH_INFO))
128
128
  @syro_inbox = inbox
129
129
 
@@ -248,10 +248,10 @@ class Syro
248
248
  end
249
249
 
250
250
  def initialize(&block)
251
- @sandbox = Sandbox.new(block)
251
+ @code = block
252
252
  end
253
253
 
254
254
  def call(env, inbox = {})
255
- @sandbox.call(env, inbox)
255
+ Sandbox.new(@code).call(env, inbox)
256
256
  end
257
257
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "syro"
3
- s.version = "0.0.1"
3
+ s.version = "0.0.2"
4
4
  s.summary = "Simple router"
5
5
  s.description = "Simple router for web applications"
6
6
  s.authors = ["Michel Martens"]
@@ -88,6 +88,20 @@ app = Syro.new {
88
88
  }
89
89
  }
90
90
  }
91
+
92
+ on("one") {
93
+ @one = "1"
94
+
95
+ get {
96
+ res.write(@one)
97
+ }
98
+ }
99
+
100
+ on("two") {
101
+ get {
102
+ res.write(@one)
103
+ }
104
+ }
91
105
  }
92
106
 
93
107
  setup do
@@ -157,3 +171,13 @@ test "inherited inbox" do |f|
157
171
  assert_equal "GET /posts/42/comments", f.last_response.body
158
172
  assert_equal 200, f.last_response.status
159
173
  end
174
+
175
+ test "leaks" do |f|
176
+ f.get("/one")
177
+ assert_equal "1", f.last_response.body
178
+ assert_equal 200, f.last_response.status
179
+
180
+ f.get("/two")
181
+ assert_equal "", f.last_response.body
182
+ assert_equal 200, f.last_response.status
183
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-23 00:00:00.000000000 Z
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: seg