minitest-rails 1.0.1 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -10
- data/CHANGELOG.rdoc +0 -24
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/Manifest.txt +31 -31
- data/README.rdoc +15 -17
- data/Rakefile +5 -6
- data/gemfiles/{4.0.gemfile → 4.1.gemfile} +2 -1
- data/lib/generators/minitest/controller/controller_generator.rb +20 -0
- data/lib/generators/{mini_test → minitest}/controller/templates/controller_spec.rb +0 -0
- data/lib/generators/{mini_test → minitest}/controller/templates/controller_test.rb +0 -0
- data/lib/generators/minitest/generator/generator_generator.rb +32 -0
- data/lib/generators/minitest/generator/templates/generator_spec.rb +14 -0
- data/lib/generators/minitest/generator/templates/generator_test.rb +15 -0
- data/lib/generators/minitest/helper/helper_generator.rb +19 -0
- data/lib/generators/{mini_test → minitest}/helper/templates/helper_spec.rb +0 -2
- data/lib/generators/{mini_test → minitest}/helper/templates/helper_test.rb +0 -0
- data/lib/generators/{mini_test → minitest}/install/install_generator.rb +2 -2
- data/lib/generators/{mini_test → minitest}/install/templates/test_helper.rb +0 -0
- data/lib/generators/minitest/integration/integration_generator.rb +19 -0
- data/lib/generators/{mini_test → minitest}/integration/templates/integration_spec.rb +0 -0
- data/lib/generators/{mini_test → minitest}/integration/templates/integration_test.rb +0 -0
- data/lib/generators/minitest/mailer/mailer_generator.rb +27 -0
- data/lib/generators/{mini_test → minitest}/mailer/templates/mailer_spec.rb +0 -0
- data/lib/generators/{mini_test → minitest}/mailer/templates/mailer_test.rb +0 -0
- data/lib/generators/minitest/mailer/templates/preview.rb +13 -0
- data/lib/generators/minitest/model/model_generator.rb +42 -0
- data/lib/generators/{mini_test → minitest}/model/templates/fixtures.yml +0 -0
- data/lib/generators/{mini_test → minitest}/model/templates/model_spec.rb +0 -0
- data/lib/generators/{mini_test → minitest}/model/templates/model_test.rb +0 -0
- data/lib/generators/{mini_test → minitest}/route/route_generator.rb +4 -4
- data/lib/generators/{mini_test → minitest}/route/templates/route_spec.rb +1 -1
- data/lib/generators/{mini_test → minitest}/route/templates/route_test.rb +1 -1
- data/lib/generators/minitest/scaffold/scaffold_generator.rb +38 -0
- data/lib/generators/{mini_test → minitest}/scaffold/templates/controller_spec.rb +4 -4
- data/lib/generators/{mini_test → minitest}/scaffold/templates/controller_test.rb +4 -4
- data/lib/generators/minitest.rb +14 -0
- data/lib/minitest/rails/assertions.rb +54 -270
- data/lib/minitest/rails/constant_lookup.rb +1 -1
- data/lib/minitest/rails/expectations.rb +2 -90
- data/lib/minitest/rails/railtie.rb +4 -4
- data/lib/minitest/rails/tasks/minitest.rake +20 -20
- data/lib/minitest/rails/tasks/sub_test_task.rb +1 -1
- data/lib/minitest/rails/testing.rb +2 -2
- data/lib/minitest/rails/version.rb +2 -2
- data/lib/minitest/rails.rb +38 -14
- data/minitest-rails.gemspec +13 -16
- data/tasks/test.rake +4 -31
- data/test/generators/test_controller_generator.rb +6 -6
- data/test/generators/test_generator_generator.rb +58 -0
- data/test/generators/test_helper_generator.rb +5 -5
- data/test/generators/test_install_generator.rb +3 -3
- data/test/generators/test_mailer_generator.rb +5 -5
- data/test/generators/test_model_generator.rb +9 -9
- data/test/generators/test_route_generator.rb +3 -3
- data/test/generators/test_scaffold_generator.rb +3 -3
- data/test/helper.rb +4 -1
- data/test/rails/action_controller/test_spec_type.rb +19 -14
- data/test/rails/action_dispatch/test_spec_type.rb +32 -29
- data/test/rails/action_mailer/test_spec_type.rb +19 -14
- data/test/rails/action_view/test_spec_type.rb +24 -18
- data/test/rails/active_support/test_assertions.rb +0 -28
- data/test/rails/active_support/test_expectations.rb +0 -28
- data/test/rails/active_support/test_spec_type.rb +9 -5
- data/test/rails/generators/test_spec_type.rb +13 -14
- data/test/test_sanity.rb +2 -2
- metadata +48 -61
- data/gemfiles/3.0.gemfile +0 -5
- data/gemfiles/3.1.gemfile +0 -5
- data/gemfiles/3.2.gemfile +0 -5
- data/gemfiles/minitest_tu_shim.rb +0 -4
- data/lib/generators/mini_test/controller/controller_generator.rb +0 -19
- data/lib/generators/mini_test/helper/helper_generator.rb +0 -17
- data/lib/generators/mini_test/integration/integration_generator.rb +0 -17
- data/lib/generators/mini_test/mailer/mailer_generator.rb +0 -19
- data/lib/generators/mini_test/model/model_generator.rb +0 -28
- data/lib/generators/mini_test/scaffold/scaffold_generator.rb +0 -42
- data/lib/generators/mini_test.rb +0 -42
- data/lib/minitest/rails/generators.rb +0 -18
@@ -1,9 +1,8 @@
|
|
1
1
|
require "helper"
|
2
|
-
require "minitest/rails/generators"
|
3
2
|
|
4
3
|
class InstallGenerator < Rails::Generators::Base; end
|
5
4
|
|
6
|
-
class TestGeneratorsSpecType <
|
5
|
+
class TestGeneratorsSpecType < Minitest::Test
|
7
6
|
def assert_generator actual
|
8
7
|
assert_equal Rails::Generators::TestCase, actual
|
9
8
|
end
|
@@ -13,24 +12,24 @@ class TestGeneratorsSpecType < MiniTest::Unit::TestCase
|
|
13
12
|
end
|
14
13
|
|
15
14
|
def test_spec_type_resolves_for_class_constants
|
16
|
-
assert_generator
|
15
|
+
assert_generator Minitest::Spec.spec_type(InstallGenerator)
|
17
16
|
end
|
18
17
|
|
19
18
|
def test_spec_type_resolves_for_matching_strings
|
20
|
-
assert_generator
|
21
|
-
assert_generator
|
22
|
-
assert_generator
|
19
|
+
assert_generator Minitest::Spec.spec_type("InstallGenerator")
|
20
|
+
assert_generator Minitest::Spec.spec_type("InstallGeneratorTest")
|
21
|
+
assert_generator Minitest::Spec.spec_type("Install Generator Test")
|
23
22
|
# And is not case sensitive
|
24
|
-
assert_generator
|
25
|
-
assert_generator
|
26
|
-
assert_generator
|
23
|
+
assert_generator Minitest::Spec.spec_type("installgenerator")
|
24
|
+
assert_generator Minitest::Spec.spec_type("installgeneratortest")
|
25
|
+
assert_generator Minitest::Spec.spec_type("install generator test")
|
27
26
|
end
|
28
27
|
|
29
28
|
def test_spec_type_wont_match_non_space_characters
|
30
|
-
refute_generator
|
31
|
-
refute_generator
|
32
|
-
refute_generator
|
33
|
-
refute_generator
|
34
|
-
refute_generator
|
29
|
+
refute_generator Minitest::Spec.spec_type("Install Generator\tTest")
|
30
|
+
refute_generator Minitest::Spec.spec_type("Install Generator\rTest")
|
31
|
+
refute_generator Minitest::Spec.spec_type("Install Generator\nTest")
|
32
|
+
refute_generator Minitest::Spec.spec_type("Install Generator\fTest")
|
33
|
+
refute_generator Minitest::Spec.spec_type("Install GeneratorXTest")
|
35
34
|
end
|
36
35
|
end
|
data/test/test_sanity.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -14,48 +14,34 @@ dependencies:
|
|
14
14
|
name: minitest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4.7'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
17
|
+
- - ">="
|
25
18
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
-
|
28
|
-
name: minitest-test
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
19
|
+
version: 5.3.3
|
20
|
+
- - "<"
|
32
21
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
22
|
+
version: '6.0'
|
34
23
|
type: :runtime
|
35
24
|
prerelease: false
|
36
25
|
version_requirements: !ruby/object:Gem::Requirement
|
37
26
|
requirements:
|
38
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 5.3.3
|
30
|
+
- - "<"
|
39
31
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
32
|
+
version: '6.0'
|
41
33
|
- !ruby/object:Gem::Dependency
|
42
34
|
name: railties
|
43
35
|
requirement: !ruby/object:Gem::Requirement
|
44
36
|
requirements:
|
45
|
-
- - "
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
- - "<"
|
37
|
+
- - "~>"
|
49
38
|
- !ruby/object:Gem::Version
|
50
39
|
version: '4.1'
|
51
40
|
type: :runtime
|
52
41
|
prerelease: false
|
53
42
|
version_requirements: !ruby/object:Gem::Requirement
|
54
43
|
requirements:
|
55
|
-
- - "
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '3.0'
|
58
|
-
- - "<"
|
44
|
+
- - "~>"
|
59
45
|
- !ruby/object:Gem::Version
|
60
46
|
version: '4.1'
|
61
47
|
- !ruby/object:Gem::Dependency
|
@@ -100,7 +86,7 @@ dependencies:
|
|
100
86
|
- - "~>"
|
101
87
|
- !ruby/object:Gem::Version
|
102
88
|
version: '3.11'
|
103
|
-
description: Adds
|
89
|
+
description: Adds Minitest as the default testing library in Rails 3 and 4
|
104
90
|
email:
|
105
91
|
- mike@blowmage.com
|
106
92
|
executables: []
|
@@ -119,43 +105,42 @@ files:
|
|
119
105
|
- Manifest.txt
|
120
106
|
- README.rdoc
|
121
107
|
- Rakefile
|
122
|
-
- gemfiles/
|
123
|
-
- gemfiles/3.1.gemfile
|
124
|
-
- gemfiles/3.2.gemfile
|
125
|
-
- gemfiles/4.0.gemfile
|
126
|
-
- gemfiles/minitest_tu_shim.rb
|
108
|
+
- gemfiles/4.1.gemfile
|
127
109
|
- lib/generators/.document
|
128
|
-
- lib/generators/
|
129
|
-
- lib/generators/
|
130
|
-
- lib/generators/
|
131
|
-
- lib/generators/
|
132
|
-
- lib/generators/
|
133
|
-
- lib/generators/
|
134
|
-
- lib/generators/
|
135
|
-
- lib/generators/
|
136
|
-
- lib/generators/
|
137
|
-
- lib/generators/
|
138
|
-
- lib/generators/
|
139
|
-
- lib/generators/
|
140
|
-
- lib/generators/
|
141
|
-
- lib/generators/
|
142
|
-
- lib/generators/
|
143
|
-
- lib/generators/
|
144
|
-
- lib/generators/
|
145
|
-
- lib/generators/
|
146
|
-
- lib/generators/
|
147
|
-
- lib/generators/
|
148
|
-
- lib/generators/
|
149
|
-
- lib/generators/
|
150
|
-
- lib/generators/
|
151
|
-
- lib/generators/
|
152
|
-
- lib/generators/
|
110
|
+
- lib/generators/minitest.rb
|
111
|
+
- lib/generators/minitest/controller/controller_generator.rb
|
112
|
+
- lib/generators/minitest/controller/templates/controller_spec.rb
|
113
|
+
- lib/generators/minitest/controller/templates/controller_test.rb
|
114
|
+
- lib/generators/minitest/generator/generator_generator.rb
|
115
|
+
- lib/generators/minitest/generator/templates/generator_spec.rb
|
116
|
+
- lib/generators/minitest/generator/templates/generator_test.rb
|
117
|
+
- lib/generators/minitest/helper/helper_generator.rb
|
118
|
+
- lib/generators/minitest/helper/templates/helper_spec.rb
|
119
|
+
- lib/generators/minitest/helper/templates/helper_test.rb
|
120
|
+
- lib/generators/minitest/install/install_generator.rb
|
121
|
+
- lib/generators/minitest/install/templates/test_helper.rb
|
122
|
+
- lib/generators/minitest/integration/integration_generator.rb
|
123
|
+
- lib/generators/minitest/integration/templates/integration_spec.rb
|
124
|
+
- lib/generators/minitest/integration/templates/integration_test.rb
|
125
|
+
- lib/generators/minitest/mailer/mailer_generator.rb
|
126
|
+
- lib/generators/minitest/mailer/templates/mailer_spec.rb
|
127
|
+
- lib/generators/minitest/mailer/templates/mailer_test.rb
|
128
|
+
- lib/generators/minitest/mailer/templates/preview.rb
|
129
|
+
- lib/generators/minitest/model/model_generator.rb
|
130
|
+
- lib/generators/minitest/model/templates/fixtures.yml
|
131
|
+
- lib/generators/minitest/model/templates/model_spec.rb
|
132
|
+
- lib/generators/minitest/model/templates/model_test.rb
|
133
|
+
- lib/generators/minitest/route/route_generator.rb
|
134
|
+
- lib/generators/minitest/route/templates/route_spec.rb
|
135
|
+
- lib/generators/minitest/route/templates/route_test.rb
|
136
|
+
- lib/generators/minitest/scaffold/scaffold_generator.rb
|
137
|
+
- lib/generators/minitest/scaffold/templates/controller_spec.rb
|
138
|
+
- lib/generators/minitest/scaffold/templates/controller_test.rb
|
153
139
|
- lib/minitest-rails.rb
|
154
140
|
- lib/minitest/rails.rb
|
155
141
|
- lib/minitest/rails/assertions.rb
|
156
142
|
- lib/minitest/rails/constant_lookup.rb
|
157
143
|
- lib/minitest/rails/expectations.rb
|
158
|
-
- lib/minitest/rails/generators.rb
|
159
144
|
- lib/minitest/rails/railtie.rb
|
160
145
|
- lib/minitest/rails/tasks/.document
|
161
146
|
- lib/minitest/rails/tasks/minitest.rake
|
@@ -165,6 +150,7 @@ files:
|
|
165
150
|
- minitest-rails.gemspec
|
166
151
|
- tasks/test.rake
|
167
152
|
- test/generators/test_controller_generator.rb
|
153
|
+
- test/generators/test_generator_generator.rb
|
168
154
|
- test/generators/test_helper_generator.rb
|
169
155
|
- test/generators/test_install_generator.rb
|
170
156
|
- test/generators/test_mailer_generator.rb
|
@@ -205,17 +191,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
191
|
version: '0'
|
206
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
193
|
requirements:
|
208
|
-
- - "
|
194
|
+
- - ">"
|
209
195
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
196
|
+
version: 1.3.1
|
211
197
|
requirements: []
|
212
198
|
rubyforge_project:
|
213
199
|
rubygems_version: 2.2.2
|
214
200
|
signing_key:
|
215
201
|
specification_version: 4
|
216
|
-
summary:
|
202
|
+
summary: Minitest integration for Rails 4.1+
|
217
203
|
test_files:
|
218
204
|
- test/generators/test_controller_generator.rb
|
205
|
+
- test/generators/test_generator_generator.rb
|
219
206
|
- test/generators/test_helper_generator.rb
|
220
207
|
- test/generators/test_install_generator.rb
|
221
208
|
- test/generators/test_mailer_generator.rb
|
data/gemfiles/3.0.gemfile
DELETED
data/gemfiles/3.1.gemfile
DELETED
data/gemfiles/3.2.gemfile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require "generators/mini_test"
|
2
|
-
|
3
|
-
module MiniTest
|
4
|
-
module Generators
|
5
|
-
class ControllerGenerator < Base
|
6
|
-
argument :actions, :type => :array, :default => [], :banner => "action action"
|
7
|
-
|
8
|
-
check_class_collision :suffix => "ControllerTest"
|
9
|
-
|
10
|
-
def create_test_files
|
11
|
-
if options[:spec]
|
12
|
-
template "controller_spec.rb", File.join("test/controllers", class_path, "#{file_name}_controller_test.rb")
|
13
|
-
else
|
14
|
-
template "controller_test.rb", File.join("test/controllers", class_path, "#{file_name}_controller_test.rb")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require "generators/mini_test"
|
2
|
-
|
3
|
-
module MiniTest
|
4
|
-
module Generators
|
5
|
-
class HelperGenerator < Base
|
6
|
-
check_class_collision :suffix => "HelperTest"
|
7
|
-
|
8
|
-
def create_test_files
|
9
|
-
if options[:spec]
|
10
|
-
template "helper_spec.rb", File.join("test/helpers", class_path, "#{file_name}_helper_test.rb")
|
11
|
-
else
|
12
|
-
template "helper_test.rb", File.join("test/helpers", class_path, "#{file_name}_helper_test.rb")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require "generators/mini_test"
|
2
|
-
|
3
|
-
module MiniTest
|
4
|
-
module Generators
|
5
|
-
class IntegrationGenerator < Base
|
6
|
-
check_class_collision :suffix => "Test"
|
7
|
-
|
8
|
-
def create_test_files
|
9
|
-
if options[:spec]
|
10
|
-
template 'integration_spec.rb', File.join('test/integration', class_path, "#{file_name}_test.rb")
|
11
|
-
else
|
12
|
-
template 'integration_test.rb', File.join('test/integration', class_path, "#{file_name}_test.rb")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require "generators/mini_test"
|
2
|
-
|
3
|
-
module MiniTest
|
4
|
-
module Generators
|
5
|
-
class MailerGenerator < Base
|
6
|
-
argument :actions, :type => :array, :default => [], :banner => "method method"
|
7
|
-
|
8
|
-
check_class_collision :suffix => "MailerTest"
|
9
|
-
|
10
|
-
def create_test_files
|
11
|
-
if options[:spec]
|
12
|
-
template "mailer_spec.rb", File.join("test","mailers", class_path, "#{file_name}_test.rb")
|
13
|
-
else
|
14
|
-
template "mailer_test.rb", File.join("test","mailers", class_path, "#{file_name}_test.rb")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "generators/mini_test"
|
2
|
-
|
3
|
-
module MiniTest
|
4
|
-
module Generators
|
5
|
-
class ModelGenerator < Base
|
6
|
-
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
7
|
-
class_option :fixture, :type => :boolean, :default => true, :desc => "Create fixture file"
|
8
|
-
|
9
|
-
check_class_collision :suffix => "Test"
|
10
|
-
|
11
|
-
def create_test_file
|
12
|
-
if options[:spec]
|
13
|
-
template "model_spec.rb", File.join("test","models", class_path, "#{file_name}_test.rb")
|
14
|
-
else
|
15
|
-
template "model_test.rb", File.join("test","models", class_path, "#{file_name}_test.rb")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
hook_for :fixture_replacement
|
20
|
-
|
21
|
-
def create_fixture_file
|
22
|
-
if options[:fixture] && options[:fixture_replacement].nil?
|
23
|
-
template "fixtures.yml", File.join("test","fixtures", class_path, "#{plural_file_name}.yml")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require "generators/mini_test"
|
2
|
-
require "rails/generators/resource_helpers"
|
3
|
-
|
4
|
-
module MiniTest
|
5
|
-
module Generators
|
6
|
-
class ScaffoldGenerator < Base
|
7
|
-
include ::Rails::Generators::ResourceHelpers
|
8
|
-
argument :actions, :type => :array, :default => [], :banner => "action action"
|
9
|
-
|
10
|
-
check_class_collision :suffix => "ControllerTest"
|
11
|
-
|
12
|
-
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
|
13
|
-
|
14
|
-
def create_test_files
|
15
|
-
if options[:spec]
|
16
|
-
template "controller_spec.rb",
|
17
|
-
File.join("test/controllers",
|
18
|
-
class_path,
|
19
|
-
"#{controller_file_name}_controller_test.rb")
|
20
|
-
else
|
21
|
-
template "controller_test.rb",
|
22
|
-
File.join("test/controllers",
|
23
|
-
class_path,
|
24
|
-
"#{controller_file_name}_controller_test.rb")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def accessible_attributes
|
29
|
-
attributes.reject(&:reference?)
|
30
|
-
end
|
31
|
-
|
32
|
-
def attributes_hash
|
33
|
-
return if accessible_attributes.empty?
|
34
|
-
|
35
|
-
accessible_attributes.map do |a|
|
36
|
-
name = a.name
|
37
|
-
key_value name, "@#{singular_table_name}.#{name}"
|
38
|
-
end.sort.join(', ')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/generators/mini_test.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'rails/generators/named_base'
|
2
|
-
|
3
|
-
module MiniTest
|
4
|
-
module Generators
|
5
|
-
class Base < ::Rails::Generators::NamedBase #:nodoc:
|
6
|
-
|
7
|
-
class_option :old_style_hash, :type => :boolean, :default => false,
|
8
|
-
:desc => "Force using old style hash (:foo => 'bar') on Ruby >= 1.9"
|
9
|
-
|
10
|
-
class_option :spec, :type => :boolean, :default => false,
|
11
|
-
:desc => "Use MiniTest::Spec DSL"
|
12
|
-
|
13
|
-
def self.default_source_root
|
14
|
-
File.expand_path(File.join(File.dirname(__FILE__), 'mini_test', generator_name, 'templates'))
|
15
|
-
end
|
16
|
-
|
17
|
-
protected
|
18
|
-
|
19
|
-
# Fill in methods that might be missing depending on the version of Rails
|
20
|
-
|
21
|
-
def module_namespacing(&block)
|
22
|
-
yield if block_given?
|
23
|
-
end unless instance_methods(true).map(&:to_sym).include? :module_namespacing
|
24
|
-
|
25
|
-
def key_value(key, value)
|
26
|
-
if options[:old_style_hash] || RUBY_VERSION < '1.9'
|
27
|
-
":#{key} => #{value}"
|
28
|
-
else
|
29
|
-
"#{key}: #{value}"
|
30
|
-
end
|
31
|
-
end unless instance_methods(true).map(&:to_sym).include? :key_value
|
32
|
-
|
33
|
-
def attributes_names
|
34
|
-
@attributes_names ||= attributes.each_with_object([]) do |a, names|
|
35
|
-
names << a.column_name
|
36
|
-
names << "#{a.name}_type" if a.polymorphic?
|
37
|
-
end
|
38
|
-
end unless instance_methods(true).map(&:to_sym).include? :attributes_names
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require "minitest/rails"
|
2
|
-
require "rails/generators/test_case"
|
3
|
-
|
4
|
-
class Rails::Generators::TestCase
|
5
|
-
register_spec_type(self) do |desc|
|
6
|
-
Class === desc && desc < Rails::Generators::Base
|
7
|
-
end
|
8
|
-
|
9
|
-
register_spec_type(/Generator( ?Test)?\z/i, self)
|
10
|
-
|
11
|
-
def self.determine_default_generator(name)
|
12
|
-
generator = determine_constant_from_test_name(name) do |constant|
|
13
|
-
Class === constant && constant < Rails::Generators::Base
|
14
|
-
end
|
15
|
-
raise NameError.new("Unable to resolve generator for #{name}") if generator.nil?
|
16
|
-
generator
|
17
|
-
end
|
18
|
-
end
|