rory 0.3.14 → 0.3.15
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/lib/rory/controller.rb
CHANGED
@@ -11,11 +11,11 @@ module Rory
|
|
11
11
|
|
12
12
|
class << self
|
13
13
|
def before_actions
|
14
|
-
@before_actions ||=
|
14
|
+
@before_actions ||= ancestor_actions(:before)
|
15
15
|
end
|
16
16
|
|
17
17
|
def after_actions
|
18
|
-
@after_actions ||=
|
18
|
+
@after_actions ||= ancestor_actions(:after)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Register a method to run before the action method.
|
@@ -27,6 +27,13 @@ module Rory
|
|
27
27
|
def after_action(method_name)
|
28
28
|
after_actions << method_name
|
29
29
|
end
|
30
|
+
|
31
|
+
def ancestor_actions(action_type)
|
32
|
+
(ancestors - [self]).reverse.map { |c|
|
33
|
+
query_method = :"#{action_type}_actions"
|
34
|
+
c.send(query_method) if c.respond_to?(query_method)
|
35
|
+
}.flatten.compact
|
36
|
+
end
|
30
37
|
end
|
31
38
|
|
32
39
|
def initialize(request, routing, app = nil)
|
@@ -107,11 +114,11 @@ module Rory
|
|
107
114
|
private
|
108
115
|
|
109
116
|
def call_filter_set(which_set, opts = {})
|
110
|
-
opts
|
117
|
+
opts = { :break_if_response => true }.merge(opts)
|
111
118
|
filters = self.class.send(which_set)
|
112
119
|
filters.each do |filter|
|
113
|
-
self.send(filter)
|
114
120
|
break if @response && opts[:break_if_response]
|
121
|
+
self.send(filter)
|
115
122
|
end
|
116
123
|
end
|
117
124
|
|
data/lib/rory/version.rb
CHANGED
@@ -93,6 +93,7 @@ describe Rory::Controller do
|
|
93
93
|
expect(controller).to receive(:make_it_tasty).ordered
|
94
94
|
expect(controller).to receive(:letsgo).ordered
|
95
95
|
expect(controller).to receive(:rub_tummy).ordered
|
96
|
+
expect(controller).to receive(:sleep).ordered
|
96
97
|
expect(controller).to receive(:render).ordered
|
97
98
|
controller.present
|
98
99
|
end
|
@@ -105,6 +106,7 @@ describe Rory::Controller do
|
|
105
106
|
expect(controller).to receive(:make_it_tasty).never
|
106
107
|
expect(controller).to receive(:letsgo).never
|
107
108
|
expect(controller).to receive(:rub_tummy).never
|
109
|
+
expect(controller).to receive(:sleep).never
|
108
110
|
expect(controller).to receive(:render).never
|
109
111
|
controller.present
|
110
112
|
end
|
@@ -118,6 +120,7 @@ describe Rory::Controller do
|
|
118
120
|
expect(controller).to receive(:make_it_tasty).ordered
|
119
121
|
expect(controller).to receive(:letsgo).ordered.and_call_original
|
120
122
|
expect(controller).to receive(:rub_tummy).ordered
|
123
|
+
expect(controller).to receive(:sleep).ordered
|
121
124
|
expect(controller).to receive(:render).never
|
122
125
|
controller.present
|
123
126
|
end
|
@@ -129,6 +132,7 @@ describe Rory::Controller do
|
|
129
132
|
expect(controller).to receive(:make_it_tasty).ordered
|
130
133
|
expect(controller).to receive(:letsgo).never
|
131
134
|
expect(controller).to receive(:rub_tummy).ordered
|
135
|
+
expect(controller).to receive(:sleep).ordered
|
132
136
|
expect(controller).to receive(:render).ordered
|
133
137
|
controller.present
|
134
138
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- lib/tasks/rory.rake
|
206
206
|
- spec/fixture_app/config/application.rb
|
207
207
|
- spec/fixture_app/config/routes.rb
|
208
|
+
- spec/fixture_app/controllers/base_filtered_controller.rb
|
208
209
|
- spec/fixture_app/controllers/filtered_controller.rb
|
209
210
|
- spec/fixture_app/controllers/for_reals_controller.rb
|
210
211
|
- spec/fixture_app/controllers/goose/lumpies_controller.rb
|