rails_helper 1.3.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +15 -0
  2. data/Rakefile +11 -7
  3. data/lib/rails_helper.rb +43 -21
  4. data/rails_helper.gemspec +2 -1
  5. metadata +19 -14
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzgzYmUxNTFkNzE1ZTE0ZjgxNjRlYjEzNjI2NzQxYjhjYzk1ZTMzYw==
5
+ data.tar.gz: !binary |-
6
+ OTVlYzBjZTI3ZDQ2ZDZiNWQ4NzgzMDg1NjIzMDk2MTk2YmQ0ZGM4Nw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NmIyN2YzNzMwODRlZDRhNjM3MzVjMmUyNGIwZDZlODlhMWVkYjEwMjA3ZjM5
10
+ ZTlmM2VkOTZkNTc1NWY4MjFiYWEyM2ExOWRhMTM3NTVlMGI4Y2RkNzgzNTY3
11
+ Y2U2YjhhNmU5NWZlZmE0MDRlYzY1NjcxYzY5M2VmZjk2MTk4MWE=
12
+ data.tar.gz: !binary |-
13
+ OTY5N2FiYWVmNTA5NjBkNDBmZGVkMDA1N2Y0MzRiNjAyMDA5YzhmNmI5NDc5
14
+ YTBlM2RmOTQxM2EzYmUyMzk3MDIyYzc5ZDhmN2NmZGNlMDA0YzNhMjFlNDgz
15
+ YmY2MzA3MTNiMjZjYTY2Y2E4MTJkNWZhNDExMmY3MjgwM2NkNGI=
data/Rakefile CHANGED
@@ -3,6 +3,9 @@ This.author = "Ara T. Howard"
3
3
  This.email = "ara.t.howard@gmail.com"
4
4
  This.homepage = "https://github.com/ahoward/#{ This.lib }"
5
5
 
6
+ task :license do
7
+ open('LICENSE', 'w'){|fd| fd.puts "Ruby"}
8
+ end
6
9
 
7
10
  task :default do
8
11
  puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
@@ -29,7 +32,7 @@ def run_tests!(which = nil)
29
32
 
30
33
  test_rbs.each_with_index do |test_rb, index|
31
34
  testno = index + 1
32
- command = "#{ File.basename(This.ruby) } -I ./lib -I ./test/lib #{ test_rb }"
35
+ command = "#{ This.ruby } -w -I ./lib -I ./test/lib #{ test_rb }"
33
36
 
34
37
  puts
35
38
  say(div, :color => :cyan, :bold => true)
@@ -60,7 +63,7 @@ end
60
63
  task :gemspec do
61
64
  ignore_extensions = ['git', 'svn', 'tmp', /sw./, 'bak', 'gem']
62
65
  ignore_directories = ['pkg']
63
- ignore_files = ['test/log', 'a.rb'] + Dir['db/*'] + %w'db'
66
+ ignore_files = ['test/log']
64
67
 
65
68
  shiteless =
66
69
  lambda do |list|
@@ -87,9 +90,10 @@ task :gemspec do
87
90
  files = shiteless[Dir::glob("**/**")]
88
91
  executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
89
92
  #has_rdoc = true #File.exist?('doc')
90
- test_files = test(?e, "test/#{ lib }.rb") ? "test/#{ lib }.rb" : nil
93
+ test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
91
94
  summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
92
95
  description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
96
+ license = object.respond_to?(:license) ? object.license : "Ruby"
93
97
 
94
98
  if This.extensions.nil?
95
99
  This.extensions = []
@@ -100,7 +104,6 @@ task :gemspec do
100
104
  end
101
105
  extensions = [extensions].flatten.compact
102
106
 
103
- # TODO
104
107
  if This.dependencies.nil?
105
108
  dependencies = []
106
109
  else
@@ -127,6 +130,7 @@ task :gemspec do
127
130
  spec.platform = Gem::Platform::RUBY
128
131
  spec.summary = <%= lib.inspect %>
129
132
  spec.description = <%= description.inspect %>
133
+ spec.license = <%= license.inspect %>
130
134
 
131
135
  spec.files =\n<%= files.sort.pretty_inspect %>
132
136
  spec.executables = <%= executables.inspect %>
@@ -188,8 +192,8 @@ task :readme do
188
192
  end
189
193
 
190
194
  template =
191
- if test(?e, 'readme.erb')
192
- Template{ IO.read('readme.erb') }
195
+ if test(?e, 'README.erb')
196
+ Template{ IO.read('README.erb') }
193
197
  else
194
198
  Template {
195
199
  <<-__
@@ -293,7 +297,7 @@ BEGIN {
293
297
 
294
298
  # discover full path to this ruby executable
295
299
  #
296
- c = RbConfig::CONFIG
300
+ c = Config::CONFIG
297
301
  bindir = c["bindir"] || c['BINDIR']
298
302
  ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
299
303
  ruby_ext = c['EXEEXT'] || ''
@@ -1,6 +1,6 @@
1
1
  class Helper < (defined?(ActionView::Base) ? ActionView::Base : Object)
2
2
  def Helper.version
3
- '1.3.0'
3
+ '2.0.0'
4
4
  end
5
5
 
6
6
  def Helper.dependencies
@@ -10,50 +10,72 @@ class Helper < (defined?(ActionView::Base) ? ActionView::Base : Object)
10
10
  }
11
11
  end
12
12
 
13
-
14
- attr_accessor 'options'
15
- attr_accessor 'args'
16
- attr_accessor 'block'
17
- attr_accessor 'controller'
18
- attr_accessor 'modules'
19
-
20
- def initialize(*args, &block)
21
- @options = args.extract_options!.to_options!
22
- @args = args
23
- @block = block
24
-
13
+ def Helper.new(*args, &block)
14
+ options = args.extract_options!.to_options!
25
15
  controllers, args = args.partition{|arg| ActionController::Base === arg}
16
+ controller = controllers.first || Helper.current_controller || Helper.mock_controller
26
17
 
27
- @controller = controllers.first || Helper.current_controller || Helper.mock_controller
18
+ helpers = args
19
+ helpers.push(nil) if helpers.empty?
28
20
 
29
- @modules = args
21
+ helpers.flatten!
22
+ helpers.uniq!
30
23
 
31
- @controller = controller
32
- @modules.push(nil) if @modules.empty?
33
- @modules.flatten.uniq.each do |mod|
24
+ helpers.map! do |mod|
34
25
  case mod
35
26
  when NilClass, :all, 'all'
36
- extend ::ActionView::Helpers
27
+ ::ActionView::Helpers
37
28
  when Module
38
- extend mod
29
+ mod
39
30
  else
40
31
  raise ArgumentError, mod.class.name
41
32
  end
42
33
  end
34
+
35
+ view_class =
36
+ Class.new(self) do
37
+ helpers.each do |helper|
38
+ include helper
39
+ end
40
+ self.helpers = helpers
41
+ end
42
+
43
+ view_class.allocate.tap do |helper|
44
+ helper.send(:initialize, context=nil, assigns={}, controller, formats=nil)
45
+ helper
46
+ end
43
47
  end
44
48
 
45
- ### see ./actionpack/test/controller/caching_test.rb OUCH!
49
+ attr_accessor 'controller'
50
+
51
+ if Helper.superclass == ::Object
52
+ def initialize(*args, &block)
53
+ :noop
54
+ end
55
+
56
+ def Helper.helpers=(*args)
57
+ :noop
58
+ end
59
+ end
60
+
61
+ # see ./actionpack/test/controller/caching_test.rb OUCH!
62
+ #
46
63
  def Helper.mock_controller
47
64
  require 'action_dispatch/testing/test_request.rb'
48
65
  require 'action_dispatch/testing/test_response.rb'
66
+
49
67
  store = ActiveSupport::Cache::MemoryStore.new
68
+
50
69
  controller = ApplicationController.new
51
70
  controller.perform_caching = true
52
71
  controller.cache_store = store
72
+
53
73
  request = ActionDispatch::TestRequest.new
54
74
  response = ActionDispatch::TestResponse.new
75
+
55
76
  controller.request = request
56
77
  controller.response = response
78
+
57
79
  controller.send(:default_url_options).merge!(DefaultUrlOptions) if defined?(DefaultUrlOptions)
58
80
  controller
59
81
  end
@@ -3,10 +3,11 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rails_helper"
6
- spec.version = "1.3.0"
6
+ spec.version = "2.0.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rails_helper"
9
9
  spec.description = "description: rails_helper kicks the ass"
10
+ spec.license = "Ruby"
10
11
 
11
12
  spec.files =
12
13
  ["README.md", "Rakefile", "lib", "lib/rails_helper.rb", "rails_helper.gemspec"]
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ara T. Howard
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-09 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails_current
16
- requirement: &70316224506360 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *70316224506360
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rails_default_url_options
27
- requirement: &70316224505800 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ! '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '1.0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70316224505800
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
36
41
  description: ! 'description: rails_helper kicks the ass'
37
42
  email: ara.t.howard@gmail.com
38
43
  executables: []
@@ -44,27 +49,27 @@ files:
44
49
  - lib/rails_helper.rb
45
50
  - rails_helper.gemspec
46
51
  homepage: https://github.com/ahoward/rails_helper
47
- licenses: []
52
+ licenses:
53
+ - Ruby
54
+ metadata: {}
48
55
  post_install_message:
49
56
  rdoc_options: []
50
57
  require_paths:
51
58
  - lib
52
59
  required_ruby_version: !ruby/object:Gem::Requirement
53
- none: false
54
60
  requirements:
55
61
  - - ! '>='
56
62
  - !ruby/object:Gem::Version
57
63
  version: '0'
58
64
  required_rubygems_version: !ruby/object:Gem::Requirement
59
- none: false
60
65
  requirements:
61
66
  - - ! '>='
62
67
  - !ruby/object:Gem::Version
63
68
  version: '0'
64
69
  requirements: []
65
70
  rubyforge_project: codeforpeople
66
- rubygems_version: 1.8.11
71
+ rubygems_version: 2.0.3
67
72
  signing_key:
68
- specification_version: 3
73
+ specification_version: 4
69
74
  summary: rails_helper
70
75
  test_files: []