rails_helper 2.2.0 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWFkOWE1ZDZmNDJhZDRhYjI5MWVmMTRkMzE5MzVmMDU0YjQ1MDVjMA==
4
+ ZjE1MjdhODdmZjk5YTVmYmRjN2ExM2I0MTYyMzM3ZTc0NGI4YmY2NQ==
5
5
  data.tar.gz: !binary |-
6
- Njk0Y2UyNWZkNzM5OWY4NjM0NzlmOWVjY2IxZDU5ZDk2OGY5NTVhNw==
6
+ M2UzMGZhZDY1N2EwZjM0ZGI3NzNlY2E0NDU4YmYyZWJkMzE5M2U1MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjU5YzAwM2JkMmMwMTNlNzljOWUwNWJkZTI0MmE0Y2Y3NzcyOWU0MDU4ODU1
10
- MDNhOTkzNmYyZTM0N2IzNzM1N2Y5ZTU0NTI2YmNjZDEwNWY4ZTA4MTJiMTc2
11
- NWM5OGJlYWJlZTJjOTVjYzJmNmJjZGExNjZmMTczZWVmY2I1Njk=
9
+ ODJkN2E3NzAzMjA3ZWYxYTgxYTZhOWJkYTkzYzc2MTA4NjJkYzViYTdhNGNj
10
+ NDllY2RhOGYxNWI3MmU4OWY5ODYyMzAzMzQ1NDAwMjkzNzIxZjA1YzY4NWQ5
11
+ YzkzNDhjNmMzNGUzMzdiNDdjMDkzZTg1YTU2MGU0ODI0Y2Y5ZWI=
12
12
  data.tar.gz: !binary |-
13
- YWNhYWI5ODNmZWFlMTQzNDIwZmJmNGIyMzcwYjVmZDM2OTliODBhMDI2NDg0
14
- NDY2YjdiMWVjNTkxOTczMzBhODM3ZDBhNzk2ODc2OGQ4NDg2ODNiYjgyNzZj
15
- NzhjZGJiNDUxOTk4ZGFiZDYzMDYzNzdkYTZhY2M4N2EzZjdlN2M=
13
+ MWYzYjZhMjZhZmQ0YWVhNzBhNDEyMmYyN2U2NDA4NTM3YjQ5NTY5NzNlZDQ2
14
+ NjI1NjkxYjhlNzE2NmE5MGJkNzVlZjIzYThkOTQ1YzU0YWY1ZjMzN2YyY2Fm
15
+ YWVmZjFmMGQ0OGJjNWQwNmZmZGM5N2EzYjBkM2U3YzVmOTQ5MjQ=
@@ -1,6 +1,6 @@
1
1
  class Helper < (defined?(ActionView::Base) ? ActionView::Base : Object)
2
2
  def Helper.version
3
- '2.2.0'
3
+ '2.2.2'
4
4
  end
5
5
 
6
6
  def Helper.dependencies
@@ -69,12 +69,14 @@ class Helper < (defined?(ActionView::Base) ? ActionView::Base : Object)
69
69
  # see ./actionpack/test/controller/caching_test.rb OUCH!
70
70
  #
71
71
  def Helper.mock_controller
72
+ require 'rails'
73
+ require 'action_controller'
72
74
  require 'action_dispatch/testing/test_request.rb'
73
75
  require 'action_dispatch/testing/test_response.rb'
74
76
 
75
77
  store = ActiveSupport::Cache::MemoryStore.new
76
78
 
77
- controller = ApplicationController.new
79
+ controller = mock_controller_class.new
78
80
  controller.perform_caching = true
79
81
  controller.cache_store = store
80
82
 
@@ -84,10 +86,35 @@ class Helper < (defined?(ActionView::Base) ? ActionView::Base : Object)
84
86
  controller.request = request
85
87
  controller.response = response
86
88
 
87
- controller.send(:default_url_options).dup.merge(DefaultUrlOptions.dup) if defined?(DefaultUrlOptions)
89
+ singleton_class =
90
+ class << controller
91
+ self
92
+ end
93
+
94
+ singleton_class.module_eval do
95
+ define_method(:default_url_options) do
96
+ @default_url_options ||= (
97
+ defined?(DefaultUrlOptions) ? DefaultUrlOptions.dup : {}
98
+ )
99
+ end
100
+ end
101
+
88
102
  controller
89
103
  end
90
104
 
105
+ def Helper.mock_controller_class
106
+ unless const_defined?(:Controller)
107
+ controller_class =
108
+ if defined?(::ApplicationController)
109
+ Class.new(::ApplicationController)
110
+ else
111
+ Class.new(::ActionController::Base)
112
+ end
113
+ const_set(:Controller, controller_class)
114
+ end
115
+ return const_get(:Controller)
116
+ end
117
+
91
118
  def Helper.current_controller
92
119
  Current.controller
93
120
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rails_helper"
6
- spec.version = "2.2.0"
6
+ spec.version = "2.2.2"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rails_helper"
9
9
  spec.description = "description: rails_helper kicks the ass"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.2
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-09-12 00:00:00.000000000 Z
11
+ date: 2014-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails_current