responders 1.1.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -8
- data/lib/action_controller/respond_with.rb +229 -0
- data/lib/action_controller/responder.rb +302 -0
- data/lib/generators/rails/templates/controller.rb +15 -17
- data/lib/generators/responders/install_generator.rb +0 -4
- data/lib/responders.rb +11 -2
- data/lib/responders/location_responder.rb +3 -21
- data/lib/responders/version.rb +1 -1
- data/test/action_controller/respond_with_test.rb +717 -0
- data/test/{collection_responder_test.rb → responders/collection_responder_test.rb} +0 -0
- data/test/{controller_method_test.rb → responders/controller_method_test.rb} +0 -0
- data/test/{flash_responder_test.rb → responders/flash_responder_test.rb} +0 -0
- data/test/{http_cache_responder_test.rb → responders/http_cache_responder_test.rb} +0 -0
- data/test/test_helper.rb +1 -0
- data/test/views/respond_with/edit.html.erb +1 -0
- data/test/views/respond_with/new.html.erb +1 -0
- data/test/views/respond_with/respond_with_additional_params.html.erb +0 -0
- data/test/views/respond_with/using_invalid_resource_with_template.xml.erb +1 -0
- data/test/views/respond_with/using_options_with_template.xml.erb +1 -0
- data/test/views/respond_with/using_resource.js.erb +1 -0
- data/test/views/respond_with/using_resource_with_block.html.erb +1 -0
- metadata +33 -18
- data/test/location_responder_test.rb +0 -44
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/test/test_helper.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Edit world!
|
@@ -0,0 +1 @@
|
|
1
|
+
New world!
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<content>I should not be displayed</content>
|
@@ -0,0 +1 @@
|
|
1
|
+
<customer-name><%= @customer.name %></customer-name>
|
@@ -0,0 +1 @@
|
|
1
|
+
alert("Hi");
|
@@ -0,0 +1 @@
|
|
1
|
+
Hello world!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: responders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.0.alpha
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '5'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.2.0.alpha
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '5'
|
33
33
|
description: A set of Rails responders to dry up your application
|
34
34
|
email: contact@plataformatec.com.br
|
35
35
|
executables: []
|
@@ -39,6 +39,8 @@ files:
|
|
39
39
|
- CHANGELOG.md
|
40
40
|
- MIT-LICENSE
|
41
41
|
- README.md
|
42
|
+
- lib/action_controller/respond_with.rb
|
43
|
+
- lib/action_controller/responder.rb
|
42
44
|
- lib/generators/rails/USAGE
|
43
45
|
- lib/generators/rails/responders_controller_generator.rb
|
44
46
|
- lib/generators/rails/templates/controller.rb
|
@@ -51,17 +53,24 @@ files:
|
|
51
53
|
- lib/responders/locales/en.yml
|
52
54
|
- lib/responders/location_responder.rb
|
53
55
|
- lib/responders/version.rb
|
54
|
-
- test/
|
55
|
-
- test/controller_method_test.rb
|
56
|
-
- test/flash_responder_test.rb
|
57
|
-
- test/http_cache_responder_test.rb
|
56
|
+
- test/action_controller/respond_with_test.rb
|
58
57
|
- test/locales/en.yml
|
59
|
-
- test/
|
58
|
+
- test/responders/collection_responder_test.rb
|
59
|
+
- test/responders/controller_method_test.rb
|
60
|
+
- test/responders/flash_responder_test.rb
|
61
|
+
- test/responders/http_cache_responder_test.rb
|
60
62
|
- test/test_helper.rb
|
61
63
|
- test/views/addresses/create.js.erb
|
62
64
|
- test/views/addresses/edit.html.erb
|
63
65
|
- test/views/addresses/new.html.erb
|
64
66
|
- test/views/locations/new.html.erb
|
67
|
+
- test/views/respond_with/edit.html.erb
|
68
|
+
- test/views/respond_with/new.html.erb
|
69
|
+
- test/views/respond_with/respond_with_additional_params.html.erb
|
70
|
+
- test/views/respond_with/using_invalid_resource_with_template.xml.erb
|
71
|
+
- test/views/respond_with/using_options_with_template.xml.erb
|
72
|
+
- test/views/respond_with/using_resource.js.erb
|
73
|
+
- test/views/respond_with/using_resource_with_block.html.erb
|
65
74
|
homepage: http://github.com/plataformatec/responders
|
66
75
|
licenses:
|
67
76
|
- MIT
|
@@ -82,20 +91,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
91
|
version: '0'
|
83
92
|
requirements: []
|
84
93
|
rubyforge_project: responders
|
85
|
-
rubygems_version: 2.
|
94
|
+
rubygems_version: 2.2.2
|
86
95
|
signing_key:
|
87
96
|
specification_version: 4
|
88
97
|
summary: A set of Rails responders to dry up your application
|
89
98
|
test_files:
|
90
|
-
- test/
|
91
|
-
- test/controller_method_test.rb
|
92
|
-
- test/flash_responder_test.rb
|
93
|
-
- test/http_cache_responder_test.rb
|
99
|
+
- test/action_controller/respond_with_test.rb
|
94
100
|
- test/locales/en.yml
|
95
|
-
- test/
|
101
|
+
- test/responders/collection_responder_test.rb
|
102
|
+
- test/responders/controller_method_test.rb
|
103
|
+
- test/responders/flash_responder_test.rb
|
104
|
+
- test/responders/http_cache_responder_test.rb
|
96
105
|
- test/test_helper.rb
|
97
106
|
- test/views/addresses/create.js.erb
|
98
107
|
- test/views/addresses/edit.html.erb
|
99
108
|
- test/views/addresses/new.html.erb
|
100
109
|
- test/views/locations/new.html.erb
|
101
|
-
|
110
|
+
- test/views/respond_with/edit.html.erb
|
111
|
+
- test/views/respond_with/new.html.erb
|
112
|
+
- test/views/respond_with/respond_with_additional_params.html.erb
|
113
|
+
- test/views/respond_with/using_invalid_resource_with_template.xml.erb
|
114
|
+
- test/views/respond_with/using_options_with_template.xml.erb
|
115
|
+
- test/views/respond_with/using_resource.js.erb
|
116
|
+
- test/views/respond_with/using_resource_with_block.html.erb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class LocationResponder < ActionController::Responder
|
4
|
-
include Responders::LocationResponder
|
5
|
-
end
|
6
|
-
|
7
|
-
class LocationsController < ApplicationController
|
8
|
-
self.responder = LocationResponder
|
9
|
-
|
10
|
-
respond_to :html
|
11
|
-
before_filter :set_resource
|
12
|
-
|
13
|
-
def create
|
14
|
-
respond_with @resource, location: -> { 'given_location' }
|
15
|
-
end
|
16
|
-
|
17
|
-
def update
|
18
|
-
respond_with @resource, location: 'given_location'
|
19
|
-
end
|
20
|
-
|
21
|
-
def set_resource
|
22
|
-
@resource = Address.new
|
23
|
-
@resource.errors[:fail] << "FAIL" if params[:fail]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
class LocationResponderTest < ActionController::TestCase
|
28
|
-
tests LocationsController
|
29
|
-
|
30
|
-
def test_redirects_to_block_location_on_success
|
31
|
-
post :create
|
32
|
-
assert_redirected_to 'given_location'
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_renders_page_on_fail
|
36
|
-
post :create, fail: true
|
37
|
-
assert @response.body.include?('new.html.erb')
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_redirects_to_plain_string
|
41
|
-
post :update
|
42
|
-
assert_redirected_to 'given_location'
|
43
|
-
end
|
44
|
-
end
|