rack-rest_api_versioning 0.0.1 → 0.0.2

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 ADDED
@@ -0,0 +1,2 @@
1
+ pkg
2
+ *.gemspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -35,4 +35,12 @@ module Rack
35
35
  env['api_version'] = version
36
36
  end
37
37
  end
38
+
39
+ module RequestExtensions
40
+ def api_version
41
+ @env['api_version']
42
+ end
43
+ end
38
44
  end
45
+
46
+ Rack::Request.send(:include, Rack::RequestExtensions)
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class RequestTest < Test::Unit::TestCase
4
+ def test_api_version
5
+ request = Rack::Request.new('api_version' => '1.2.3')
6
+ assert_equal '1.2.3', request.api_version
7
+ end
8
+
9
+ def test_api_version_is_nil_if_not_present
10
+ request = Rack::Request.new({})
11
+ assert_nil request.api_version
12
+ end
13
+ end
@@ -1,8 +1,4 @@
1
- require 'test/unit'
2
- require 'rack'
3
- require 'rack/test'
4
-
5
- require 'rack/rest_api_versioning'
1
+ require File.dirname(__FILE__) + '/test_helper'
6
2
 
7
3
  class RestApiVersioningTest < Test::Unit::TestCase
8
4
  include Rack::Test::Methods
@@ -0,0 +1,5 @@
1
+ require 'test/unit'
2
+ require 'rack'
3
+ require 'rack/test'
4
+
5
+ require 'rack/rest_api_versioning'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Adam Cig\xC3\xA1nek"
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-08 00:00:00 +02:00
17
+ date: 2010-06-09 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -38,11 +38,14 @@ extensions: []
38
38
  extra_rdoc_files:
39
39
  - README.rdoc
40
40
  files:
41
+ - .gitignore
41
42
  - README.rdoc
42
43
  - Rakefile
43
44
  - VERSION
44
45
  - lib/rack/rest_api_versioning.rb
46
+ - test/request_test.rb
45
47
  - test/rest_api_versioning_test.rb
48
+ - test/test_helper.rb
46
49
  has_rdoc: true
47
50
  homepage: http://github.com/madadam/rack-rest_api_versioning
48
51
  licenses: []
@@ -75,3 +78,5 @@ specification_version: 3
75
78
  summary: A Rack middleware to support "the proper way" to version a RESTful API.
76
79
  test_files:
77
80
  - test/rest_api_versioning_test.rb
81
+ - test/test_helper.rb
82
+ - test/request_test.rb