rack-test-rest 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -3,7 +3,7 @@ module Rack
3
3
  module Rest
4
4
 
5
5
  def resource_uri
6
- "#{@rack_test_rest[:root_uri]}/#{@rack_test_rest[:resource]}"
6
+ "#{@rack_test_rest[:root_uri]}/#{@rack_test_rest[:resource]}"
7
7
  end
8
8
 
9
9
  def create_resource(params={})
@@ -16,10 +16,10 @@ module Rack
16
16
  if expected_code
17
17
  assert_equal(expected_code, last_response.status)
18
18
  else
19
- if @rack_test_rest[:debug]
19
+ if @rack_test_rest[:debug]
20
20
  puts "#{last_response.status}: #{last_response.body}"
21
21
  puts last_response.original_headers["Location"]
22
- end
22
+ end
23
23
  assert_equal(201, last_response.status)
24
24
  if @rack_test_rest[:location]
25
25
  assert last_response.original_headers["Location"] =~ @rack_test_rest[:location]
@@ -33,13 +33,13 @@ module Rack
33
33
  expected_code = params[:code]
34
34
  params.delete :code
35
35
 
36
- if params[:id]
36
+ if params[:id]
37
37
  id = params[:id]
38
38
  params.delete(:id)
39
- uri = resource_uri + "/#{id}.json"
40
- else
41
- uri = resource_uri + ".json"
42
- end
39
+ uri = resource_uri + "/#{id}.json"
40
+ else
41
+ uri = resource_uri + ".json"
42
+ end
43
43
 
44
44
  puts "GET #{uri} #{params}" if @rack_test_rest[:debug]
45
45
  get uri, params
@@ -47,7 +47,7 @@ module Rack
47
47
  if @rack_test_rest[:debug]
48
48
  puts "Code: #{last_response.status}"
49
49
  puts "Body: #{last_response.body}"
50
- end
50
+ end
51
51
 
52
52
  if expected_code
53
53
  assert_equal(expected_code, last_response.status)
@@ -95,7 +95,11 @@ module Rack
95
95
 
96
96
  #populate the DB
97
97
  0.upto(count - 1) do |id|
98
- create_resource(yield(id))
98
+ if params.has_key?(:do_create) && params[:do_create] == false
99
+ yield(id)
100
+ else
101
+ create_resource(yield(id))
102
+ end
99
103
  end
100
104
 
101
105
  retrieved = 0
@@ -112,7 +116,7 @@ module Rack
112
116
  puts "Expecting '#{expected_length}'"
113
117
  end
114
118
 
115
- pg_resp = read_resource(:offset => offset, :length => length)
119
+ pg_resp = read_resource(:offset => offset, :length => length)
116
120
 
117
121
  puts "Received #{pg_resp[@rack_test_rest[:resource]].count} records" if @rack_test_rest[:debug]
118
122
  assert_equal(expected_length, pg_resp[@rack_test_rest[:resource]].count)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-test-rest}
8
- s.version = "0.1.2"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joseph Ruscio"]
12
- s.date = %q{2011-09-02}
12
+ s.date = %q{2011-09-06}
13
13
  s.description = %q{rack-test-rest is an extension to rack-test that when combined with Test::Unit simplifies the process of unit testing properly designed RESTful API's.}
14
14
  s.email = %q{joe@ruscio.org}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,70 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rack-test-rest
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Joseph Ruscio
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-09-02 00:00:00.000000000 -07:00
17
+
18
+ date: 2011-09-06 00:00:00 -07:00
13
19
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: shoulda
17
- requirement: &2152553380 !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: '0'
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
23
22
  type: :development
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ name: shoulda
33
+ version_requirements: *id001
24
34
  prerelease: false
25
- version_requirements: *2152553380
26
- - !ruby/object:Gem::Dependency
27
- name: bundler
28
- requirement: &2152549900 !ruby/object:Gem::Requirement
35
+ - !ruby/object:Gem::Dependency
36
+ type: :development
37
+ requirement: &id002 !ruby/object:Gem::Requirement
29
38
  none: false
30
- requirements:
39
+ requirements:
31
40
  - - ~>
32
- - !ruby/object:Gem::Version
41
+ - !ruby/object:Gem::Version
42
+ hash: 23
43
+ segments:
44
+ - 1
45
+ - 0
46
+ - 0
33
47
  version: 1.0.0
34
- type: :development
48
+ name: bundler
49
+ version_requirements: *id002
35
50
  prerelease: false
36
- version_requirements: *2152549900
37
- - !ruby/object:Gem::Dependency
38
- name: jeweler
39
- requirement: &2152545740 !ruby/object:Gem::Requirement
51
+ - !ruby/object:Gem::Dependency
52
+ type: :development
53
+ requirement: &id003 !ruby/object:Gem::Requirement
40
54
  none: false
41
- requirements:
55
+ requirements:
42
56
  - - ~>
43
- - !ruby/object:Gem::Version
57
+ - !ruby/object:Gem::Version
58
+ hash: 7
59
+ segments:
60
+ - 1
61
+ - 5
62
+ - 2
44
63
  version: 1.5.2
45
- type: :development
64
+ name: jeweler
65
+ version_requirements: *id003
46
66
  prerelease: false
47
- version_requirements: *2152545740
48
- - !ruby/object:Gem::Dependency
49
- name: rcov
50
- requirement: &2152543680 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ! '>='
54
- - !ruby/object:Gem::Version
55
- version: '0'
67
+ - !ruby/object:Gem::Dependency
56
68
  type: :development
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ name: rcov
79
+ version_requirements: *id004
57
80
  prerelease: false
58
- version_requirements: *2152543680
59
- description: rack-test-rest is an extension to rack-test that when combined with Test::Unit
60
- simplifies the process of unit testing properly designed RESTful API's.
81
+ description: rack-test-rest is an extension to rack-test that when combined with Test::Unit simplifies the process of unit testing properly designed RESTful API's.
61
82
  email: joe@ruscio.org
62
83
  executables: []
84
+
63
85
  extensions: []
64
- extra_rdoc_files:
86
+
87
+ extra_rdoc_files:
65
88
  - LICENSE.txt
66
89
  - README.md
67
- files:
90
+ files:
68
91
  - .document
69
92
  - Gemfile
70
93
  - Gemfile.lock
@@ -78,33 +101,38 @@ files:
78
101
  - test/test_rack-test-rest.rb
79
102
  has_rdoc: true
80
103
  homepage: http://github.com/josephruscio/rack-test-rest
81
- licenses:
104
+ licenses:
82
105
  - MIT
83
106
  post_install_message:
84
107
  rdoc_options: []
85
- require_paths:
108
+
109
+ require_paths:
86
110
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
111
+ required_ruby_version: !ruby/object:Gem::Requirement
88
112
  none: false
89
- requirements:
90
- - - ! '>='
91
- - !ruby/object:Gem::Version
92
- version: '0'
93
- segments:
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ hash: 3
117
+ segments:
94
118
  - 0
95
- hash: -410277042666572099
96
- required_rubygems_version: !ruby/object:Gem::Requirement
119
+ version: "0"
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
121
  none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
128
+ version: "0"
102
129
  requirements: []
130
+
103
131
  rubyforge_project:
104
132
  rubygems_version: 1.6.2
105
133
  signing_key:
106
134
  specification_version: 3
107
135
  summary: Abstractions for testing RESTful API's with rack-test and Test::Unit.
108
- test_files:
136
+ test_files:
109
137
  - test/helper.rb
110
138
  - test/test_rack-test-rest.rb