rails_current 1.8.2 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/rails_current.rb +41 -28
- data/rails_current.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTEyNzAzZTc0MGYzOWZhMzc0MjY5ZTY1N2MyOWQ1ZGRkOGFhZDE2NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmE2NzM3YjYxMjIzMTcxM2QzYWZlMTRjYmEyOGM0M2MwNjczMTM5ZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDZlZjA1ZmY4MzIzZTJjMWIxMTg1YmNkZjllYWY0ZGQ4YjdkMjk3NjE3YmFl
|
10
|
+
NDAyMWJmMDA4ZjhhNjExZDFlNDYwNDFmZTcxMTk5MjZjOThhZDk0NzVlZGIy
|
11
|
+
OTkyNGNlOGYwMmRhYWRkNDE0YjQzMDJjMWY5NGUwNDYwNWM5OGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWM4ODVlMTIzNWU0OTgzMzUzNGQ4NjI0YjkyZDlhZGZjODEzZmIxYzVhNGY5
|
14
|
+
NjE2ZjNiMzMyMTdiY2NkZDA5YWQ1ZGJiYTZlNjRiZjdkN2U3Mzc0NjUyNDdl
|
15
|
+
NWQwYzcyNmM5ZjU3YThiYzY3MWU2NzNhYmNkNjRhNzI5YmQyZTU=
|
data/lib/rails_current.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Current
|
4
4
|
def Current.version
|
5
|
-
'1.
|
5
|
+
'1.9.0'
|
6
6
|
end
|
7
7
|
|
8
8
|
def Current.dependencies
|
@@ -161,40 +161,53 @@ module Current
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def Current.mock_controller(options = {})
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
164
|
+
ensure_rails_application do
|
165
|
+
require 'action_controller'
|
166
|
+
require 'action_dispatch/testing/test_request.rb'
|
167
|
+
require 'action_dispatch/testing/test_response.rb'
|
168
168
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
169
|
+
store = ActiveSupport::Cache::MemoryStore.new
|
170
|
+
|
171
|
+
controller = mock_controller_class.new
|
172
|
+
controller.perform_caching = true
|
173
|
+
controller.cache_store = store
|
174
|
+
|
175
|
+
request = ActionDispatch::TestRequest.new
|
176
|
+
response = ActionDispatch::TestResponse.new
|
177
|
+
|
178
|
+
controller.request = request
|
179
|
+
controller.response = response
|
180
|
+
|
181
|
+
singleton_class =
|
182
|
+
class << controller
|
183
|
+
self
|
184
|
+
end
|
185
|
+
|
186
|
+
singleton_class.module_eval do
|
187
|
+
define_method(:default_url_options) do
|
188
|
+
@default_url_options ||= (
|
189
|
+
defined?(DefaultUrlOptions) ? DefaultUrlOptions.dup : {}
|
190
|
+
)
|
191
|
+
end
|
175
192
|
end
|
176
193
|
|
177
|
-
ensure_rails_application do
|
178
|
-
store = ActiveSupport::Cache::MemoryStore.new
|
179
|
-
controller =
|
180
|
-
begin
|
181
|
-
ApplicationController.new
|
182
|
-
rescue NameError
|
183
|
-
ActionController::Base.new
|
184
|
-
end
|
185
|
-
controller.perform_caching = true
|
186
|
-
controller.cache_store = store
|
187
|
-
request = ActionDispatch::TestRequest.new
|
188
|
-
response = ActionDispatch::TestResponse.new
|
189
|
-
controller.request = request
|
190
|
-
controller.response = response
|
191
|
-
#controller.send(:initialize_template_class, response)
|
192
|
-
#controller.send(:assign_shortcuts, request, response)
|
193
|
-
controller.send(:default_url_options).merge!(default_url_options)
|
194
194
|
Current.proxy_for(controller)
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
+
def Current.mock_controller_class
|
199
|
+
unless const_defined?(:Controller)
|
200
|
+
controller_class =
|
201
|
+
if defined?(::ApplicationController)
|
202
|
+
Class.new(::ApplicationController)
|
203
|
+
else
|
204
|
+
Class.new(::ActionController::Base)
|
205
|
+
end
|
206
|
+
const_set(:Controller, controller_class)
|
207
|
+
end
|
208
|
+
return const_get(:Controller)
|
209
|
+
end
|
210
|
+
|
198
211
|
def Current.ensure_rails_application(&block)
|
199
212
|
require 'rails' unless defined?(Rails)
|
200
213
|
if Rails.application.nil?
|
data/rails_current.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "rails_current"
|
6
|
-
spec.version = "1.
|
6
|
+
spec.version = "1.9.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "rails_current"
|
9
9
|
spec.description = "track 'current_user' et all in a tidy, global, and thread-safe fashion for your rails apps"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_current
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: map
|