newark 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b1b007d826796f975e53a238c1f3f8bec78b94d
4
- data.tar.gz: 361aa3310e4bd3231f5cba710be13adbacf2a67a
3
+ metadata.gz: 846aac93a0c6b2c08f5ce424b677ff56fc6a4b92
4
+ data.tar.gz: d7265afa0ff668bab4b6b81e7b5bb0a99dd15d15
5
5
  SHA512:
6
- metadata.gz: d1c10396d7c1182363d55352e3998b8549a396ca1b5ecbaa5fab7925001c67936b863e76acf052bc03d1ac890619cff74333e24d0e995602a724c9a93983af94
7
- data.tar.gz: 90ad0f2f607cd75ff633392ce51e03c3ae0f858c07021067f2e42efa548f57cf84a4de904587cf448c9e4e23f272ec9bf9f36413122c638a55aa59751921f980
6
+ metadata.gz: 07a01715c7df2648363dc34df83eda6b4000f2dfd2bba48c6f47cb17b05aee2672214f5726181ae578e89ed7c2aaa8161214ef4caa2e1333cc8e48f4d16be442
7
+ data.tar.gz: cfd18aef273a3a3cf18ca952848c51da0e056e7e5e033daed91b67bd22a341a43de56457606b95bac002d4c3919928acffd0ac24ba86e70884ed9b01cd39092f
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .ruby-version
data/lib/newark/app.rb CHANGED
@@ -75,7 +75,6 @@ module Newark
75
75
  def route
76
76
  route = match_route
77
77
  if route
78
- request.params.merge!(route.params)
79
78
  if exec_before_hooks
80
79
  response.body = exec(route.handler)
81
80
  exec_after_hooks
data/lib/newark/route.rb CHANGED
@@ -6,7 +6,7 @@ module Newark
6
6
  PATH_MATCHER = /\*(?<path>.*)/.freeze
7
7
  PATH_SUB = /\*.*/.freeze
8
8
 
9
- attr_reader :handler, :params
9
+ attr_reader :handler
10
10
 
11
11
  def initialize(path, constraints, handler)
12
12
  fail ArgumentError, 'You must define a route handler' if handler.nil?
@@ -18,8 +18,10 @@ module Newark
18
18
 
19
19
  def match?(request)
20
20
  path_data = path_match?(request)
21
- if path_data && constraints_match?(request)
22
- @params = Hash[ path_data.names.zip( path_data.captures ) ]
21
+ (path_data && constraints_match?(request)).tap do |matched|
22
+ if matched
23
+ request.params.merge! Hash[ path_data.names.zip( path_data.captures ) ]
24
+ end
23
25
  end
24
26
  end
25
27
 
@@ -1,3 +1,3 @@
1
1
  module Newark
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
data/test/test_app.rb CHANGED
@@ -40,7 +40,7 @@ class TestApp < MiniTest::Unit::TestCase
40
40
  include Rack::Test::Methods
41
41
 
42
42
  def app
43
- NameApp.new
43
+ Rack::Lint.new(NameApp.new)
44
44
  end
45
45
 
46
46
  def test_instance_method_access
data/test/test_request.rb CHANGED
@@ -25,7 +25,7 @@ class TestRequest < MiniTest::Unit::TestCase
25
25
  include Rack::Test::Methods
26
26
 
27
27
  def app
28
- RequestApp.new
28
+ Rack::Lint.new(RequestApp.new)
29
29
  end
30
30
 
31
31
  def test_uri
@@ -44,7 +44,7 @@ class TestRequest < MiniTest::Unit::TestCase
44
44
  end
45
45
 
46
46
  def test_body
47
- post '/body', {}, { 'rack.input' => StringIO.new('fubar') }
47
+ post '/body', 'fubar'
48
48
  assert_equal 'fubar', last_response.body
49
49
  end
50
50
 
@@ -14,7 +14,7 @@ class TestResponse < MiniTest::Unit::TestCase
14
14
  include Rack::Test::Methods
15
15
 
16
16
  def app
17
- ResponseApp.new
17
+ Rack::Lint.new(ResponseApp.new)
18
18
  end
19
19
 
20
20
  def test_json_api
data/test/test_router.rb CHANGED
@@ -67,7 +67,7 @@ class TestRouter < MiniTest::Unit::TestCase
67
67
  include Rack::Test::Methods
68
68
 
69
69
  def app
70
- TestingApp.new
70
+ Rack::Lint.new(TestingApp.new)
71
71
  end
72
72
 
73
73
  def test_gets_root
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack