roar-rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES.markdown +6 -0
- data/gemfiles/Gemfile.rails3-0 +0 -2
- data/gemfiles/Gemfile.rails3-2 +0 -2
- data/gemfiles/Gemfile.rails4-0 +0 -2
- data/lib/roar-rails.rb +7 -1
- data/lib/roar/rails/controller_additions.rb +5 -1
- data/lib/roar/rails/rails3_0_strategy.rb +8 -0
- data/lib/roar/rails/rails3_1_strategy.rb +8 -0
- data/lib/roar/rails/rails3_2_strategy.rb +11 -0
- data/lib/roar/rails/test_case.rb +11 -2
- data/lib/roar/rails/version.rb +1 -1
- data/roar-rails.gemspec +1 -1
- data/test/consume_test.rb +17 -0
- metadata +26 -47
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b1ea90fac1d4d0f740b45d12ded7f1db7af0c26e
|
4
|
+
data.tar.gz: 9c77c62ec70cd206238d49d2e387b556783199c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8bb37394bb6c50e75bbd7a6168cf4925713a548fbbc96a5ccb4672e1b7e2a0e93bbbaccde93167dcf4fde56e192e7f08721907847bd286f9e0664ac3c019d2e2
|
7
|
+
data.tar.gz: 402b43bbd21317a323db435af6e713399364eb3a471db05628026a5ca73d96d1a0a5bfd467ec228c26eb986a91ec582e905891a795050f64dd5fef482827b43f
|
data/CHANGES.markdown
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
h2. 0.1.2
|
2
|
+
|
3
|
+
* Introducing a check where `request.body.read` is called (as usual) if `request.body.string` isn't present. This is due to some faulty behaviour in Rails and some web servers that don't provide a properly working `#read`, as it's the Rack rule. Should finally fix https://github.com/apotonick/roar-rails/issues/18 and friends.
|
4
|
+
* `TestCase#process` no longer triggers a deprecation warning for Rails > 3.1.
|
5
|
+
* Now allows using roar >= 0.11.
|
6
|
+
|
1
7
|
h2. 0.1.1
|
2
8
|
|
3
9
|
* Added the `represented_formats: [...]` option to be passed to `#respond_with` for either suppressing roar-rails from extending/decorating models when rendering or to fine-tune so this will only happen on white-listed formats as `:hal`. This can also be set globally using `config.representer.represented_formats`.
|
data/gemfiles/Gemfile.rails3-0
CHANGED
data/gemfiles/Gemfile.rails3-2
CHANGED
data/gemfiles/Gemfile.rails4-0
CHANGED
data/lib/roar-rails.rb
CHANGED
@@ -24,10 +24,16 @@ module Roar
|
|
24
24
|
::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 0
|
25
25
|
end
|
26
26
|
|
27
|
+
def self.rails3_1?
|
28
|
+
::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 1
|
29
|
+
end
|
30
|
+
|
27
31
|
if rails3_0?
|
28
32
|
require 'roar/rails/rails3_0_strategy'
|
29
|
-
|
33
|
+
elsif rails3_1?
|
30
34
|
require 'roar/rails/rails3_1_strategy'
|
35
|
+
else
|
36
|
+
require 'roar/rails/rails3_2_strategy'
|
31
37
|
end
|
32
38
|
|
33
39
|
autoload("TestCase", "roar/rails/test_case")
|
@@ -48,7 +48,11 @@ module Roar::Rails
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def incoming_string
|
51
|
-
request.body
|
51
|
+
body = request.body
|
52
|
+
|
53
|
+
# this is my first respond_to? ever and i hate it (thanks, Rails :)
|
54
|
+
return body.string if body.respond_to?(:string)
|
55
|
+
body.read
|
52
56
|
end
|
53
57
|
|
54
58
|
def render_to_body(options)
|
data/lib/roar/rails/test_case.rb
CHANGED
@@ -33,16 +33,25 @@ module Roar
|
|
33
33
|
|
34
34
|
request.env['RAW_POST_DATA'] = document
|
35
35
|
|
36
|
-
super(action,
|
36
|
+
super(*process_args(action, http_method, document, params))
|
37
37
|
end
|
38
38
|
|
39
|
+
private
|
40
|
+
module ProcessArgs
|
41
|
+
def process_args(*args) # TODO: remove when <= 3.1 support is dropped (in 2016).
|
42
|
+
args
|
43
|
+
end
|
44
|
+
end
|
45
|
+
include ProcessArgs
|
46
|
+
include TestCase::VersionStrategy # overwrites #process_args for <= 3.1.
|
47
|
+
|
48
|
+
|
39
49
|
module Assertions
|
40
50
|
def assert_body(body, options={})
|
41
51
|
return assert_xml_equal body, response.body if options[:xml]
|
42
52
|
assert_equal body, response.body
|
43
53
|
end
|
44
54
|
end
|
45
|
-
|
46
55
|
include Assertions
|
47
56
|
end
|
48
57
|
end
|
data/lib/roar/rails/version.rb
CHANGED
data/roar-rails.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_runtime_dependency "roar", "
|
21
|
+
s.add_runtime_dependency "roar", ">= 0.11.13"
|
22
22
|
s.add_runtime_dependency "test_xml", ">= 0.1.6" # TODO: remove dependency as most people don't use XML.
|
23
23
|
s.add_runtime_dependency "actionpack"
|
24
24
|
s.add_runtime_dependency "railties", ">= 3.0.0"
|
data/test/consume_test.rb
CHANGED
@@ -70,3 +70,20 @@ class ConsumeWithOptionsOverridingConfigurationTest < ActionController::TestCase
|
|
70
70
|
assert_equal %{#<struct Singer name="Bumi">}, @response.body
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
class RequestBodyStringTest < ConsumeTest
|
75
|
+
test "allows Request instances supporting #string instead of #read" do
|
76
|
+
@request.instance_eval do
|
77
|
+
def body
|
78
|
+
Object.new.instance_eval do
|
79
|
+
def read; ""; end
|
80
|
+
def string; "{\"name\": \"Bumi\"}"; end # in rails 4, for whatever reasons, #read doesn't work as expected.
|
81
|
+
|
82
|
+
self
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
post :consume_json, "{\"name\": \"Bumi\"}", :format => 'json'
|
87
|
+
assert_equal %{#<struct Singer name="Bumi">}, @response.body
|
88
|
+
end
|
89
|
+
end
|
metadata
CHANGED
@@ -1,100 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roar-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nick Sutterer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-08-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: roar
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.11.13
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.11.13
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: test_xml
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.1.6
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.1.6
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: actionpack
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: railties
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 3.0.0
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 3.0.0
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: hooks
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: minitest
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,65 +97,57 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: activemodel
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: activerecord
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
117
|
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - '>='
|
140
123
|
- !ruby/object:Gem::Version
|
141
124
|
version: '0'
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: sqlite3
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
|
-
- -
|
129
|
+
- - '>='
|
148
130
|
- !ruby/object:Gem::Version
|
149
131
|
version: '0'
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
|
-
- -
|
136
|
+
- - '>='
|
156
137
|
- !ruby/object:Gem::Version
|
157
138
|
version: '0'
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: tzinfo
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
|
-
- -
|
143
|
+
- - '>='
|
164
144
|
- !ruby/object:Gem::Version
|
165
145
|
version: '0'
|
166
146
|
type: :development
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
|
-
- -
|
150
|
+
- - '>='
|
172
151
|
- !ruby/object:Gem::Version
|
173
152
|
version: '0'
|
174
153
|
description: Rails extensions for using Roar in the popular web framework.
|
@@ -193,6 +172,7 @@ files:
|
|
193
172
|
- lib/roar/rails/hal.rb
|
194
173
|
- lib/roar/rails/rails3_0_strategy.rb
|
195
174
|
- lib/roar/rails/rails3_1_strategy.rb
|
175
|
+
- lib/roar/rails/rails3_2_strategy.rb
|
196
176
|
- lib/roar/rails/railtie.rb
|
197
177
|
- lib/roar/rails/responder.rb
|
198
178
|
- lib/roar/rails/test_case.rb
|
@@ -248,26 +228,25 @@ files:
|
|
248
228
|
- test/validations_test.rb
|
249
229
|
homepage: ''
|
250
230
|
licenses: []
|
231
|
+
metadata: {}
|
251
232
|
post_install_message:
|
252
233
|
rdoc_options: []
|
253
234
|
require_paths:
|
254
235
|
- lib
|
255
236
|
required_ruby_version: !ruby/object:Gem::Requirement
|
256
|
-
none: false
|
257
237
|
requirements:
|
258
|
-
- -
|
238
|
+
- - '>='
|
259
239
|
- !ruby/object:Gem::Version
|
260
240
|
version: '0'
|
261
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
|
-
none: false
|
263
242
|
requirements:
|
264
|
-
- -
|
243
|
+
- - '>='
|
265
244
|
- !ruby/object:Gem::Version
|
266
245
|
version: '0'
|
267
246
|
requirements: []
|
268
247
|
rubyforge_project: roar-rails
|
269
|
-
rubygems_version:
|
248
|
+
rubygems_version: 2.0.3
|
270
249
|
signing_key:
|
271
|
-
specification_version:
|
250
|
+
specification_version: 4
|
272
251
|
summary: Use Roar in Rails.
|
273
252
|
test_files: []
|