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,97 +1,9 @@
|
|
1
|
-
module
|
1
|
+
module Minitest::Rails::Expectations
|
2
2
|
|
3
3
|
##############################################################################
|
4
4
|
# ActiveSupport Expectations
|
5
5
|
##############################################################################
|
6
6
|
|
7
|
-
##
|
8
|
-
# Checks if an expression is blank. Passes if actual.blank? is true.
|
9
|
-
#
|
10
|
-
# === This expectation is deprecated.
|
11
|
-
#
|
12
|
-
# Use the following to check for <tt>blank?</tt> instead:
|
13
|
-
#
|
14
|
-
# actual.must_be :blank?
|
15
|
-
#
|
16
|
-
# The deprecated expectation can be called like this:
|
17
|
-
#
|
18
|
-
# "".must_be_blank
|
19
|
-
# nil.must_be_blank
|
20
|
-
# [].must_be_blank
|
21
|
-
# {}.must_be_blank
|
22
|
-
#
|
23
|
-
# See also ActiveSupport::TestCase#assert_blank
|
24
|
-
#
|
25
|
-
# :method: must_be_blank
|
26
|
-
# :args: message = nil
|
27
|
-
infect_an_assertion :assert_blank, :must_be_blank, :unary
|
28
|
-
|
29
|
-
##
|
30
|
-
# Checks if an expression is not present. Passes if actual.present? is false.
|
31
|
-
#
|
32
|
-
# === This expectation is deprecated.
|
33
|
-
#
|
34
|
-
# Use the following to check for <tt>present?</tt> instead:
|
35
|
-
#
|
36
|
-
# actual.wont_be :present?
|
37
|
-
#
|
38
|
-
# The deprecated expectation can be called like this:
|
39
|
-
#
|
40
|
-
# "".wont_be_present
|
41
|
-
# nil.wont_be_present
|
42
|
-
# [].wont_be_present
|
43
|
-
# {}.wont_be_present
|
44
|
-
#
|
45
|
-
# See also ActiveSupport::TestCase#refute_present
|
46
|
-
#
|
47
|
-
# :method: wont_be_present
|
48
|
-
# :args: message = nil
|
49
|
-
infect_an_assertion :refute_present, :wont_be_present, :unary
|
50
|
-
|
51
|
-
##
|
52
|
-
# Checks if an expression is present. Passes if actual.present? is true.
|
53
|
-
#
|
54
|
-
# === This expectation is deprecated.
|
55
|
-
#
|
56
|
-
# Use the following to check for <tt>present?</tt> instead:
|
57
|
-
#
|
58
|
-
# actual.must_be :present?
|
59
|
-
#
|
60
|
-
# The deprecated expectation can be called like this:
|
61
|
-
#
|
62
|
-
# "here".must_be_present
|
63
|
-
# Object.new.must_be_present
|
64
|
-
# [1,2,3].must_be_present
|
65
|
-
# {:key => :value}.must_be_present
|
66
|
-
#
|
67
|
-
# See also ActiveSupport::TestCase#assert_present
|
68
|
-
#
|
69
|
-
# :method: must_be_present
|
70
|
-
# :args: message = nil
|
71
|
-
infect_an_assertion :assert_present, :must_be_present, :unary
|
72
|
-
|
73
|
-
##
|
74
|
-
# Checks if an expression is not blank. Passes if actual.blank? is false.
|
75
|
-
#
|
76
|
-
# === This expectation is deprecated.
|
77
|
-
#
|
78
|
-
# Use the following to check for <tt>blank?</tt> instead:
|
79
|
-
#
|
80
|
-
# actual.wont_be :blank?
|
81
|
-
#
|
82
|
-
# The deprecated expectation can be called like this:
|
83
|
-
#
|
84
|
-
# "here".wont_be_blank
|
85
|
-
# Object.new.wont_be_blank
|
86
|
-
# [1,2,3].wont_be_blank
|
87
|
-
# {:key => :value}.wont_be_blank
|
88
|
-
#
|
89
|
-
# See also ActiveSupport::TestCase#refute_blank
|
90
|
-
#
|
91
|
-
# :method: wont_be_blank
|
92
|
-
# :args: message = nil
|
93
|
-
infect_an_assertion :refute_blank, :wont_be_blank, :unary
|
94
|
-
|
95
7
|
##
|
96
8
|
# Checks the numeric difference between the return value of an expression as a result of what is evaluated.
|
97
9
|
#
|
@@ -622,7 +534,7 @@ end
|
|
622
534
|
|
623
535
|
unless ENV["MT_NO_EXPECTATIONS"]
|
624
536
|
class Object # :nodoc:
|
625
|
-
include
|
537
|
+
include Minitest::Rails::Expectations
|
626
538
|
end
|
627
539
|
# Not real expectations, just aliases
|
628
540
|
# The error messages don't get messed up this way
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require "rails"
|
2
2
|
|
3
|
-
module
|
3
|
+
module Minitest
|
4
4
|
module Rails
|
5
5
|
class Railtie < ::Rails::Railtie # :nodoc:
|
6
6
|
generators = config.respond_to?(:app_generators) ? config.app_generators : config.generators
|
7
|
-
generators.integration_tool :
|
8
|
-
generators.test_framework :
|
9
|
-
generators.fallbacks[:
|
7
|
+
generators.integration_tool :minitest
|
8
|
+
generators.test_framework :minitest
|
9
|
+
generators.fallbacks[:minitest] = :test_unit
|
10
10
|
|
11
11
|
rake_tasks do
|
12
12
|
load "minitest/rails/tasks/minitest.rake"
|
@@ -25,42 +25,42 @@ namespace "minitest" do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# Run a single test
|
28
|
-
|
28
|
+
Minitest::Rails::Tasks::SubTestTask.new(single: "test:prepare") do |t|
|
29
29
|
t.libs << "test"
|
30
30
|
end
|
31
31
|
|
32
|
-
# Run the default tests as definded in
|
33
|
-
|
32
|
+
# Run the default tests as definded in Minitest::Rails::Testing.default_tasks
|
33
|
+
Minitest::Rails::Tasks::SubTestTask.new(run: "test:prepare") do |t|
|
34
34
|
t.libs.push "test"
|
35
|
-
t.pattern = "test/{#{
|
35
|
+
t.pattern = "test/{#{Minitest::Rails::Testing.default_tasks.join(',')}}/**/*_test.rb"
|
36
36
|
end
|
37
37
|
|
38
|
-
# Run the default tests as definded in
|
38
|
+
# Run the default tests as definded in Minitest::Rails::Testing.default_tasks
|
39
39
|
desc "Runs the default tests, without resetting the db"
|
40
|
-
|
40
|
+
Minitest::Rails::Tasks::SubTestTask.new(:quick) do |t|
|
41
41
|
t.libs.push "test"
|
42
|
-
t.pattern = "test/{#{
|
42
|
+
t.pattern = "test/{#{Minitest::Rails::Testing.default_tasks.join(',')}}/**/*_test.rb"
|
43
43
|
end
|
44
44
|
|
45
45
|
desc "Runs all tests"
|
46
|
-
|
46
|
+
Minitest::Rails::Tasks::SubTestTask.new(all: "test:prepare") do |t|
|
47
47
|
t.libs.push "test"
|
48
48
|
t.pattern = "test/**/*_test.rb"
|
49
49
|
end
|
50
50
|
|
51
51
|
namespace "all" do
|
52
52
|
desc "Runs all tests, without resetting the db"
|
53
|
-
|
53
|
+
Minitest::Rails::Tasks::SubTestTask.new(:quick) do |t|
|
54
54
|
t.libs.push "test"
|
55
55
|
t.pattern = "test/**/*_test.rb"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
# Loop that will define a task for each directory that has tests
|
60
|
-
|
60
|
+
Minitest::Rails::Testing.all_tasks.each do |task_dir|
|
61
61
|
unless Rake::Task.task_defined? "minitest:#{task_dir}"
|
62
62
|
desc "Runs tests under test/#{task_dir}"
|
63
|
-
|
63
|
+
Minitest::Rails::Tasks::SubTestTask.new(task_dir => "test:prepare") do |t|
|
64
64
|
t.libs.push "test"
|
65
65
|
t.pattern = "test/#{task_dir}/**/*_test.rb"
|
66
66
|
end
|
@@ -72,7 +72,7 @@ end
|
|
72
72
|
# Statistics
|
73
73
|
|
74
74
|
# set hook on stats task
|
75
|
-
task :
|
75
|
+
task stats: "minitest:setup_stats"
|
76
76
|
|
77
77
|
namespace "minitest" do
|
78
78
|
task :setup_stats do
|
@@ -83,7 +83,7 @@ namespace "minitest" do
|
|
83
83
|
CodeStatistics::TEST_TYPES.clear
|
84
84
|
|
85
85
|
# Add test directories that minitest-rails knows about
|
86
|
-
|
86
|
+
Minitest::Rails::Testing.all_tasks.each do |dir|
|
87
87
|
name = "#{dir.capitalize} tests"
|
88
88
|
STATS_DIRECTORIES << [ name, Rails.root.join("test").join(dir).to_s ]
|
89
89
|
CodeStatistics::TEST_TYPES << name
|
@@ -94,28 +94,28 @@ end
|
|
94
94
|
# Define tasks under "test" if they don't already exist
|
95
95
|
if !Rake::Task.task_defined? :test
|
96
96
|
desc "Runs default tests"
|
97
|
-
task :
|
97
|
+
task test: "minitest"
|
98
98
|
|
99
99
|
namespace "test" do
|
100
|
-
|
100
|
+
Minitest::Rails::Testing.all_tasks.each do |task_dir|
|
101
101
|
desc "Runs tests under test/#{task_dir}"
|
102
102
|
task task_dir => "minitest:#{task_dir}"
|
103
103
|
end
|
104
104
|
|
105
105
|
desc "Runs the default tests, without resetting the db"
|
106
|
-
task
|
106
|
+
task quick: "minitest:quick"
|
107
107
|
|
108
108
|
desc "Runs all tests"
|
109
|
-
task
|
109
|
+
task all: "minitest:all"
|
110
110
|
|
111
111
|
namespace "all" do
|
112
112
|
desc "Runs all tests, without resetting the db"
|
113
|
-
task
|
113
|
+
task quick: "minitest:all:quick"
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
118
|
# Override the default task
|
119
|
-
task :
|
119
|
+
task default: [] # Just in case it hasn't already been set
|
120
120
|
Rake::Task[:default].clear
|
121
|
-
task :
|
121
|
+
task default: "minitest"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "rake/testtask"
|
2
2
|
|
3
|
-
module
|
3
|
+
module Minitest
|
4
4
|
module Rails
|
5
5
|
module Testing
|
6
6
|
mattr_accessor :default_tasks
|
@@ -10,7 +10,7 @@ module MiniTest
|
|
10
10
|
# The default tasks that are to be run by <tt>rake minitest</tt>.
|
11
11
|
#
|
12
12
|
# # Add test/presenters to default test task
|
13
|
-
#
|
13
|
+
# Minitest::Rails::Testing.default_tasks << "presenters"
|
14
14
|
#
|
15
15
|
# Default values are: models helpers controllers mailers integration
|
16
16
|
# :attr: default_tasks
|
data/lib/minitest/rails.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
gem "minitest"
|
2
|
-
require "minitest
|
2
|
+
require "minitest"
|
3
3
|
require "minitest/test"
|
4
4
|
require "minitest/spec"
|
5
5
|
require "minitest/mock"
|
@@ -18,19 +18,22 @@ class ActiveSupport::TestCase
|
|
18
18
|
end if self.respond_to? :describe
|
19
19
|
|
20
20
|
# Add spec DSL
|
21
|
-
extend
|
21
|
+
extend Minitest::Spec::DSL
|
22
22
|
|
23
23
|
# Resolve constants from the test name when using the spec DSL
|
24
|
-
include
|
24
|
+
include Minitest::Rails::Testing::ConstantLookup
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
class ActiveSupport::TestCase
|
28
|
+
if defined?(ActiveRecord::Base)
|
29
29
|
# Use AS::TestCase for the base class when describing a model
|
30
30
|
register_spec_type(self) do |desc|
|
31
31
|
desc < ActiveRecord::Base if desc.is_a?(Class)
|
32
32
|
end
|
33
33
|
end
|
34
|
+
register_spec_type(self) do |desc, addl|
|
35
|
+
:model == addl
|
36
|
+
end
|
34
37
|
end
|
35
38
|
|
36
39
|
require "action_controller/test_case"
|
@@ -40,6 +43,9 @@ class ActionController::TestCase
|
|
40
43
|
Class === desc && desc < ActionController::Metal
|
41
44
|
end
|
42
45
|
register_spec_type(/Controller( ?Test)?\z/i, self)
|
46
|
+
register_spec_type(self) do |desc, addl|
|
47
|
+
:controller == addl
|
48
|
+
end
|
43
49
|
|
44
50
|
# Resolve the controller from the test name when using the spec DSL
|
45
51
|
def self.determine_default_controller_class(name)
|
@@ -55,6 +61,9 @@ require "action_view/test_case"
|
|
55
61
|
class ActionView::TestCase
|
56
62
|
# Use AV::TestCase for the base class for helpers and views
|
57
63
|
register_spec_type(/(Helper( ?Test)?| View Test)\z/i, self)
|
64
|
+
register_spec_type(self) do |desc, addl|
|
65
|
+
[ :view, :helper ].include? addl
|
66
|
+
end
|
58
67
|
|
59
68
|
# Resolve the helper or view from the test name when using the spec DSL
|
60
69
|
def self.determine_default_helper_class(name)
|
@@ -73,6 +82,9 @@ if defined? ActionMailer
|
|
73
82
|
desc < ActionMailer::Base if desc.is_a?(Class)
|
74
83
|
end
|
75
84
|
register_spec_type(/Mailer( ?Test)?\z/i, self)
|
85
|
+
register_spec_type(self) do |desc, addl|
|
86
|
+
:mailer == addl
|
87
|
+
end
|
76
88
|
|
77
89
|
# Resolve the mailer from the test name when using the spec DSL
|
78
90
|
def self.determine_default_mailer(name)
|
@@ -89,6 +101,27 @@ require "action_dispatch/testing/integration"
|
|
89
101
|
class ActionDispatch::IntegrationTest
|
90
102
|
# Register by name, consider Acceptance to be deprecated
|
91
103
|
register_spec_type(/(Integration|Acceptance)( ?Test)?\z/i, self)
|
104
|
+
register_spec_type(self) do |desc, addl|
|
105
|
+
:integration == addl
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
class Rails::Generators::TestCase
|
110
|
+
register_spec_type(self) do |desc|
|
111
|
+
desc < Rails::Generators::Base if desc.is_a?(Class)
|
112
|
+
end
|
113
|
+
register_spec_type(/Generator( ?Test)?\z/i, self)
|
114
|
+
register_spec_type(self) do |desc, addl|
|
115
|
+
:generator == addl
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.determine_default_generator(name)
|
119
|
+
generator = determine_constant_from_test_name(name) do |constant|
|
120
|
+
Class === constant && constant < Rails::Generators::Base
|
121
|
+
end
|
122
|
+
raise NameError.new("Unable to resolve generator for #{name}") if generator.nil?
|
123
|
+
generator
|
124
|
+
end
|
92
125
|
end
|
93
126
|
|
94
127
|
################################################################################
|
@@ -100,15 +133,6 @@ require "minitest/rails/expectations"
|
|
100
133
|
|
101
134
|
# :stopdoc:
|
102
135
|
|
103
|
-
################################################################################
|
104
|
-
# 1.8.7 Spec DSL Support
|
105
|
-
################################################################################
|
106
|
-
|
107
|
-
if LoadError.const_defined? :REGEXPS
|
108
|
-
# Add relaxed regexp to allow whitespace so nested describes won't fail on 1.8.
|
109
|
-
LoadError::REGEXPS.unshift(/^Missing \w+ (?:file\s*)?(.+\.rb)/i)
|
110
|
-
end
|
111
|
-
|
112
136
|
################################################################################
|
113
137
|
# Run load hooks so that other gems can register spec types
|
114
138
|
################################################################################
|
data/minitest-rails.gemspec
CHANGED
@@ -1,47 +1,44 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: minitest-rails
|
2
|
+
# stub: minitest-rails 2.0.0.beta1.20140414183410 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "minitest-rails"
|
6
|
-
s.version = "
|
6
|
+
s.version = "2.0.0.beta1.20140414183410"
|
7
7
|
|
8
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Mike Moore"]
|
11
11
|
s.date = "2014-04-15"
|
12
|
-
s.description = "Adds
|
12
|
+
s.description = "Adds Minitest as the default testing library in Rails 3 and 4"
|
13
13
|
s.email = ["mike@blowmage.com"]
|
14
14
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
|
15
|
-
s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/
|
15
|
+
s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/4.1.gemfile", "lib/generators/.document", "lib/generators/minitest.rb", "lib/generators/minitest/controller/controller_generator.rb", "lib/generators/minitest/controller/templates/controller_spec.rb", "lib/generators/minitest/controller/templates/controller_test.rb", "lib/generators/minitest/generator/generator_generator.rb", "lib/generators/minitest/generator/templates/generator_spec.rb", "lib/generators/minitest/generator/templates/generator_test.rb", "lib/generators/minitest/helper/helper_generator.rb", "lib/generators/minitest/helper/templates/helper_spec.rb", "lib/generators/minitest/helper/templates/helper_test.rb", "lib/generators/minitest/install/install_generator.rb", "lib/generators/minitest/install/templates/test_helper.rb", "lib/generators/minitest/integration/integration_generator.rb", "lib/generators/minitest/integration/templates/integration_spec.rb", "lib/generators/minitest/integration/templates/integration_test.rb", "lib/generators/minitest/mailer/mailer_generator.rb", "lib/generators/minitest/mailer/templates/mailer_spec.rb", "lib/generators/minitest/mailer/templates/mailer_test.rb", "lib/generators/minitest/mailer/templates/preview.rb", "lib/generators/minitest/model/model_generator.rb", "lib/generators/minitest/model/templates/fixtures.yml", "lib/generators/minitest/model/templates/model_spec.rb", "lib/generators/minitest/model/templates/model_test.rb", "lib/generators/minitest/route/route_generator.rb", "lib/generators/minitest/route/templates/route_spec.rb", "lib/generators/minitest/route/templates/route_test.rb", "lib/generators/minitest/scaffold/scaffold_generator.rb", "lib/generators/minitest/scaffold/templates/controller_spec.rb", "lib/generators/minitest/scaffold/templates/controller_test.rb", "lib/minitest-rails.rb", "lib/minitest/rails.rb", "lib/minitest/rails/assertions.rb", "lib/minitest/rails/constant_lookup.rb", "lib/minitest/rails/expectations.rb", "lib/minitest/rails/railtie.rb", "lib/minitest/rails/tasks/.document", "lib/minitest/rails/tasks/minitest.rake", "lib/minitest/rails/tasks/sub_test_task.rb", "lib/minitest/rails/testing.rb", "lib/minitest/rails/version.rb", "minitest-rails.gemspec", "tasks/test.rake", "test/generators/test_controller_generator.rb", "test/generators/test_generator_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_route_generator.rb", "test/generators/test_scaffold_generator.rb", "test/helper.rb", "test/rails/action_controller/test_assertions.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_expectations.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/action_dispatch/test_spec_type.rb", "test/rails/action_mailer/test_mailers.rb", "test/rails/action_mailer/test_spec_type.rb", "test/rails/action_view/test_helpers.rb", "test/rails/action_view/test_spec_type.rb", "test/rails/active_support/test_assertions.rb", "test/rails/active_support/test_expectations.rb", "test/rails/active_support/test_spec_type.rb", "test/rails/generators/test_spec_type.rb", "test/rails/minitest_5_api_test.rb", "test/rails/test_constant_lookup.rb", "test/test_sanity.rb"]
|
16
16
|
s.homepage = "http://blowmage.com/minitest-rails"
|
17
17
|
s.licenses = ["MIT"]
|
18
18
|
s.rdoc_options = ["--main", "README.rdoc"]
|
19
19
|
s.rubygems_version = "2.2.2"
|
20
|
-
s.summary = "
|
21
|
-
s.test_files = ["test/generators/test_controller_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_route_generator.rb", "test/generators/test_scaffold_generator.rb", "test/rails/action_controller/test_assertions.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_expectations.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/action_dispatch/test_spec_type.rb", "test/rails/action_mailer/test_mailers.rb", "test/rails/action_mailer/test_spec_type.rb", "test/rails/action_view/test_helpers.rb", "test/rails/action_view/test_spec_type.rb", "test/rails/active_support/test_assertions.rb", "test/rails/active_support/test_expectations.rb", "test/rails/active_support/test_spec_type.rb", "test/rails/generators/test_spec_type.rb", "test/rails/test_constant_lookup.rb", "test/test_sanity.rb", "test/rails/minitest_5_api_test.rb"]
|
20
|
+
s.summary = "Minitest integration for Rails 4.1+"
|
21
|
+
s.test_files = ["test/generators/test_controller_generator.rb", "test/generators/test_generator_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_route_generator.rb", "test/generators/test_scaffold_generator.rb", "test/rails/action_controller/test_assertions.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_expectations.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/action_dispatch/test_spec_type.rb", "test/rails/action_mailer/test_mailers.rb", "test/rails/action_mailer/test_spec_type.rb", "test/rails/action_view/test_helpers.rb", "test/rails/action_view/test_spec_type.rb", "test/rails/active_support/test_assertions.rb", "test/rails/active_support/test_expectations.rb", "test/rails/active_support/test_spec_type.rb", "test/rails/generators/test_spec_type.rb", "test/rails/test_constant_lookup.rb", "test/test_sanity.rb", "test/rails/minitest_5_api_test.rb"]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
s.specification_version = 4
|
25
25
|
|
26
26
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
-
s.add_runtime_dependency(%q<minitest>, ["
|
28
|
-
s.add_runtime_dependency(%q<
|
29
|
-
s.add_runtime_dependency(%q<railties>, ["< 4.1", ">= 3.0"])
|
27
|
+
s.add_runtime_dependency(%q<minitest>, ["< 6.0", ">= 5.3.3"])
|
28
|
+
s.add_runtime_dependency(%q<railties>, ["~> 4.1"])
|
30
29
|
s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
|
31
30
|
s.add_development_dependency(%q<fakefs>, ["= 0.4.3"])
|
32
31
|
s.add_development_dependency(%q<hoe>, ["~> 3.11"])
|
33
32
|
else
|
34
|
-
s.add_dependency(%q<minitest>, ["
|
35
|
-
s.add_dependency(%q<
|
36
|
-
s.add_dependency(%q<railties>, ["< 4.1", ">= 3.0"])
|
33
|
+
s.add_dependency(%q<minitest>, ["< 6.0", ">= 5.3.3"])
|
34
|
+
s.add_dependency(%q<railties>, ["~> 4.1"])
|
37
35
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
38
36
|
s.add_dependency(%q<fakefs>, ["= 0.4.3"])
|
39
37
|
s.add_dependency(%q<hoe>, ["~> 3.11"])
|
40
38
|
end
|
41
39
|
else
|
42
|
-
s.add_dependency(%q<minitest>, ["
|
43
|
-
s.add_dependency(%q<
|
44
|
-
s.add_dependency(%q<railties>, ["< 4.1", ">= 3.0"])
|
40
|
+
s.add_dependency(%q<minitest>, ["< 6.0", ">= 5.3.3"])
|
41
|
+
s.add_dependency(%q<railties>, ["~> 4.1"])
|
45
42
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
46
43
|
s.add_dependency(%q<fakefs>, ["= 0.4.3"])
|
47
44
|
s.add_dependency(%q<hoe>, ["~> 3.11"])
|
data/tasks/test.rake
CHANGED
@@ -1,41 +1,14 @@
|
|
1
1
|
namespace :test do
|
2
|
-
desc "Run tests for Rails 4.
|
3
|
-
task "4.
|
2
|
+
desc "Run tests for Rails 4.1"
|
3
|
+
task "4.1" do
|
4
4
|
sh "rm -f Gemfile.lock"
|
5
|
-
ENV["RAILS_VERSION"] = "4.
|
6
|
-
sh "bundle && bundle exec rake test"
|
7
|
-
sh "rm -f Gemfile.lock"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc "Run tests for Rails 3.2"
|
11
|
-
task "3.2" do
|
12
|
-
sh "rm -f Gemfile.lock"
|
13
|
-
ENV["RAILS_VERSION"] = "3.2"
|
14
|
-
sh "bundle && bundle exec rake test"
|
15
|
-
sh "rm -f Gemfile.lock"
|
16
|
-
end
|
17
|
-
|
18
|
-
desc "Run tests for Rails 3.1"
|
19
|
-
task "3.1" do
|
20
|
-
sh "rm -f Gemfile.lock"
|
21
|
-
ENV["RAILS_VERSION"] = "3.1"
|
22
|
-
sh "bundle && bundle exec rake test"
|
23
|
-
sh "rm -f Gemfile.lock"
|
24
|
-
end
|
25
|
-
|
26
|
-
desc "Run tests for Rails 3.0"
|
27
|
-
task "3.0" do
|
28
|
-
sh "rm -f Gemfile.lock"
|
29
|
-
ENV["RAILS_VERSION"] = "3.0"
|
5
|
+
ENV["RAILS_VERSION"] = "4.1"
|
30
6
|
sh "bundle && bundle exec rake test"
|
31
7
|
sh "rm -f Gemfile.lock"
|
32
8
|
end
|
33
9
|
|
34
10
|
desc "Run tests for all Rails versions"
|
35
11
|
task "all" do
|
36
|
-
sh "rake test:4.
|
37
|
-
sh "rake test:3.2"
|
38
|
-
sh "rake test:3.1"
|
39
|
-
sh "rake test:3.0"
|
12
|
+
sh "rake test:4.1"
|
40
13
|
end
|
41
14
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "helper"
|
2
|
-
require "generators/
|
2
|
+
require "generators/minitest/controller/controller_generator"
|
3
3
|
|
4
4
|
class TestControllerGenerator < GeneratorTest
|
5
5
|
|
6
6
|
def test_controller_generator
|
7
7
|
assert_output(/create test\/controllers\/user_controller_test.rb/m) do
|
8
|
-
|
8
|
+
Minitest::Generators::ControllerGenerator.start ["user"]
|
9
9
|
end
|
10
10
|
assert File.exists? "test/controllers/user_controller_test.rb"
|
11
11
|
contents = File.read "test/controllers/user_controller_test.rb"
|
@@ -14,7 +14,7 @@ class TestControllerGenerator < GeneratorTest
|
|
14
14
|
|
15
15
|
def test_namespaced_controller_generator
|
16
16
|
assert_output(/create test\/controllers\/admin\/user_controller_test.rb/m) do
|
17
|
-
|
17
|
+
Minitest::Generators::ControllerGenerator.start ["admin/user"]
|
18
18
|
end
|
19
19
|
assert File.exists? "test/controllers/admin/user_controller_test.rb"
|
20
20
|
contents = File.read "test/controllers/admin/user_controller_test.rb"
|
@@ -26,7 +26,7 @@ class TestControllerGenerator < GeneratorTest
|
|
26
26
|
Rails::Generators.namespace = TestApp
|
27
27
|
|
28
28
|
assert_output(/create test\/controllers\/test_app\/user_controller_test.rb/m) do
|
29
|
-
|
29
|
+
Minitest::Generators::ControllerGenerator.start ["user"]
|
30
30
|
end
|
31
31
|
assert File.exists? "test/controllers/test_app/user_controller_test.rb"
|
32
32
|
contents = File.read "test/controllers/test_app/user_controller_test.rb"
|
@@ -39,7 +39,7 @@ class TestControllerGenerator < GeneratorTest
|
|
39
39
|
|
40
40
|
def test_controller_generator_spec
|
41
41
|
assert_output(/create test\/controllers\/user_controller_test.rb/m) do
|
42
|
-
|
42
|
+
Minitest::Generators::ControllerGenerator.start ["user", "--spec"]
|
43
43
|
end
|
44
44
|
assert File.exists? "test/controllers/user_controller_test.rb"
|
45
45
|
contents = File.read "test/controllers/user_controller_test.rb"
|
@@ -48,7 +48,7 @@ class TestControllerGenerator < GeneratorTest
|
|
48
48
|
|
49
49
|
def test_namespaced_controller_generator_spec
|
50
50
|
assert_output(/create test\/controllers\/admin\/user_controller_test.rb/m) do
|
51
|
-
|
51
|
+
Minitest::Generators::ControllerGenerator.start ["admin/user", "--spec"]
|
52
52
|
end
|
53
53
|
assert File.exists? "test/controllers/admin/user_controller_test.rb"
|
54
54
|
contents = File.read "test/controllers/admin/user_controller_test.rb"
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "helper"
|
2
|
+
require "generators/minitest/generator/generator_generator"
|
3
|
+
|
4
|
+
class TestGeneratorGenerator < GeneratorTest
|
5
|
+
|
6
|
+
def test_generator_generator
|
7
|
+
assert_output(/create test\/lib\/generators\/awesome_generator_test.rb/m) do
|
8
|
+
Minitest::Generators::GeneratorGenerator.start ["awesome"]
|
9
|
+
end
|
10
|
+
assert File.exists? "test/lib/generators/awesome_generator_test.rb"
|
11
|
+
contents = File.read "test/lib/generators/awesome_generator_test.rb"
|
12
|
+
assert_match(/class AwesomeGeneratorTest/m, contents)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_namespaced_generator_generator
|
16
|
+
assert_output(/create test\/lib\/generators\/rails\/awesome_generator_test.rb/m) do
|
17
|
+
Minitest::Generators::GeneratorGenerator.start ["rails/awesome"]
|
18
|
+
end
|
19
|
+
assert File.exists? "test/lib/generators/rails/awesome_generator_test.rb"
|
20
|
+
contents = File.read "test/lib/generators/rails/awesome_generator_test.rb"
|
21
|
+
assert_match(/class Rails::AwesomeGeneratorTest/m, contents)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_module_namespaced_generator_generator
|
25
|
+
assert_nil Rails::Generators.namespace
|
26
|
+
Rails::Generators.namespace = TestApp
|
27
|
+
|
28
|
+
assert_output(/create test\/lib\/generators\/test_app\/awesome_generator_test.rb/m) do
|
29
|
+
Minitest::Generators::GeneratorGenerator.start ["awesome"]
|
30
|
+
end
|
31
|
+
assert File.exists? "test/lib/generators/test_app/awesome_generator_test.rb"
|
32
|
+
contents = File.read "test/lib/generators/test_app/awesome_generator_test.rb"
|
33
|
+
assert_match(/module TestApp/m, contents)
|
34
|
+
assert_match(/class AwesomeGeneratorTest/m, contents)
|
35
|
+
ensure
|
36
|
+
# Restore default namespace
|
37
|
+
Rails::Generators.namespace = nil
|
38
|
+
end if Rails::Generators.respond_to? :namespace
|
39
|
+
|
40
|
+
def test_generator_generator_spec
|
41
|
+
assert_output(/create test\/lib\/generators\/awesome_generator_test.rb/m) do
|
42
|
+
Minitest::Generators::GeneratorGenerator.start ["awesome", "--spec"]
|
43
|
+
end
|
44
|
+
assert File.exists? "test/lib/generators/awesome_generator_test.rb"
|
45
|
+
contents = File.read "test/lib/generators/awesome_generator_test.rb"
|
46
|
+
assert_match(/describe AwesomeGenerator do/m, contents)
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_namespaced_generator_generator_spec
|
50
|
+
assert_output(/create test\/lib\/generators\/rails\/awesome_generator_test.rb/m) do
|
51
|
+
Minitest::Generators::GeneratorGenerator.start ["rails/awesome", "--spec"]
|
52
|
+
end
|
53
|
+
assert File.exists? "test/lib/generators/rails/awesome_generator_test.rb"
|
54
|
+
contents = File.read "test/lib/generators/rails/awesome_generator_test.rb"
|
55
|
+
assert_match(/describe Rails::AwesomeGenerator do/m, contents)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|