minitest-rails 0.1.3 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -6
- data/CHANGELOG.rdoc +11 -1
- data/Manifest.txt +6 -1
- data/README.rdoc +2 -0
- data/Rakefile +1 -1
- data/lib/autotest/discover.rb +5 -0
- data/lib/autotest/fixtures.rb +7 -0
- data/lib/autotest/migrate.rb +5 -0
- data/lib/autotest/minitest_rails.rb +62 -0
- data/lib/minitest-rails.rb +1 -1
- data/lib/minitest/rails/action_dispatch.rb +2 -0
- data/lib/minitest/rails/action_view.rb +3 -0
- data/lib/minitest/rails/active_support.rb +1 -1
- data/lib/minitest/rails/tasks/minitest.rake +6 -0
- data/minitest-rails.gemspec +7 -7
- data/test/rails/action_controller/test_spec_type.rb +21 -13
- data/test/rails/test_action_dispatch_spec_type.rb +21 -13
- data/test/rails/test_action_mailer_spec_type.rb +21 -13
- data/test/rails/test_action_view_spec_type.rb +30 -12
- data/test/rails/test_active_support_spec_type.rb +27 -0
- data/test/{test_minitest.rb → test_sanity.rb} +0 -0
- metadata +12 -6
data/.travis.yml
CHANGED
data/CHANGELOG.rdoc
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
+
=== 0.2 / 2012-09-19
|
2
|
+
|
3
|
+
* Add support for Autotest (closes #64)
|
4
|
+
* Override default rake task (closes #67)
|
5
|
+
* Add support for matching view specs names (closes #70)
|
6
|
+
* Fixed travis builds (closes #69)
|
7
|
+
* Fix bug with registering AS:TestCase (closes #73)
|
8
|
+
|
9
|
+
https://github.com/blowmage/minitest-rails/compare/v0.1.3...v0.2
|
10
|
+
|
1
11
|
=== 0.1.3 / 2012-08-02
|
2
12
|
|
3
13
|
* Significant improvements to nested describe blocks (closes #58)
|
4
|
-
* Tests no longer need write permission to the
|
14
|
+
* Tests no longer need write permission to the filesystem
|
5
15
|
|
6
16
|
https://github.com/blowmage/minitest-rails/compare/v0.1.2...v0.1.3
|
7
17
|
|
data/Manifest.txt
CHANGED
@@ -13,6 +13,10 @@ gemfiles/3.1.gemfile.lock
|
|
13
13
|
gemfiles/3.2.gemfile
|
14
14
|
gemfiles/3.2.gemfile.lock
|
15
15
|
gemfiles/minitest_tu_shim.rb
|
16
|
+
lib/autotest/discover.rb
|
17
|
+
lib/autotest/fixtures.rb
|
18
|
+
lib/autotest/migrate.rb
|
19
|
+
lib/autotest/minitest_rails.rb
|
16
20
|
lib/generators/mini_test.rb
|
17
21
|
lib/generators/mini_test/controller/controller_generator.rb
|
18
22
|
lib/generators/mini_test/controller/templates/controller_spec.rb
|
@@ -59,4 +63,5 @@ test/rails/action_controller/test_spec_type.rb
|
|
59
63
|
test/rails/test_action_dispatch_spec_type.rb
|
60
64
|
test/rails/test_action_mailer_spec_type.rb
|
61
65
|
test/rails/test_action_view_spec_type.rb
|
62
|
-
test/
|
66
|
+
test/rails/test_active_support_spec_type.rb
|
67
|
+
test/test_sanity.rb
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'autotest'
|
2
|
+
|
3
|
+
class Autotest::MinitestRails < Autotest
|
4
|
+
VERSION = "0.2"
|
5
|
+
|
6
|
+
def initialize # :nodoc:
|
7
|
+
super
|
8
|
+
|
9
|
+
add_exception %r%^\./(?:db|doc|log|public|script|tmp|vendor)%
|
10
|
+
|
11
|
+
clear_mappings
|
12
|
+
|
13
|
+
add_mapping %r%^app/models/(.*)\.rb$% do |_, m|
|
14
|
+
files_matching %r%^test/models/#{m[1]}.*_test.rb$%
|
15
|
+
end
|
16
|
+
|
17
|
+
add_mapping %r%^app/controllers/(.*)_controller\.rb$% do |_, m|
|
18
|
+
if m[1] == "application" then
|
19
|
+
files_matching %r%^test/(controllers|views)/.*_test\.rb$%
|
20
|
+
else
|
21
|
+
files_matching %r%^test/(controllers|views)/#{m[1]}.*_test.rb$%
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
add_mapping %r%^app/helpers/(.*)_helper.rb% do |_, m|
|
26
|
+
if m[1] == "application" then
|
27
|
+
files_matching %r%^test/(helpers|views|controllers)/.*_test\.rb$%
|
28
|
+
else
|
29
|
+
files_matching %r%^test/(helpers|views|controllers)/#{m[1]}.*_test.rb$%
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
add_mapping %r%^app/views/(.*)/% do |_, m|
|
34
|
+
files_matching %r%^test/(controllers|views)/#{m[1]}.*_test.rb$%
|
35
|
+
end
|
36
|
+
|
37
|
+
add_mapping %r%^app/mailers/(.*)\.rb$% do |_, m|
|
38
|
+
files_matching %r%^test/mailers/#{m[1]}.*_test.rb$%
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
add_mapping %r%^app/lib/(.*)\.rb$% do |_, m|
|
43
|
+
files_matching %r%^test/lib/#{m[1]}.*_test.rb$%
|
44
|
+
end
|
45
|
+
|
46
|
+
add_mapping %r%^test/.*_test\.rb$% do |filename, _|
|
47
|
+
filename
|
48
|
+
end
|
49
|
+
|
50
|
+
add_mapping %r%^test/fixtures/(.*)s.yml% do |_, m|
|
51
|
+
files_matching %r%^test/(models|controllers|views)/#{m[1]}.*_test.rb$%
|
52
|
+
end
|
53
|
+
|
54
|
+
add_mapping %r%^config/routes.rb$% do # FIX:
|
55
|
+
files_matching %r%^test/(controllers|views|acceptance)/.*_test\.rb$%
|
56
|
+
end
|
57
|
+
|
58
|
+
add_mapping %r%^test/*_helper.rb|config/((boot|environment(s/test)?).rb|database.yml)% do
|
59
|
+
files_matching %r%^test/(models|controllers|views|lib|acceptance)/.*_test\.rb$%
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/minitest-rails.rb
CHANGED
data/minitest-rails.gemspec
CHANGED
@@ -2,41 +2,41 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "minitest-rails"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.2.20120919094008"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Mike Moore"]
|
9
|
-
s.date = "2012-
|
9
|
+
s.date = "2012-09-19"
|
10
10
|
s.description = "Adds MiniTest as the default testing library in Rails 3.x"
|
11
11
|
s.email = ["mike@blowmage.com"]
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
|
13
|
-
s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/3.0.gemfile", "gemfiles/3.0.gemfile.lock", "gemfiles/3.1.gemfile", "gemfiles/3.1.gemfile.lock", "gemfiles/3.2.gemfile", "gemfiles/3.2.gemfile.lock", "gemfiles/minitest_tu_shim.rb", "lib/generators/mini_test.rb", "lib/generators/mini_test/controller/controller_generator.rb", "lib/generators/mini_test/controller/templates/controller_spec.rb", "lib/generators/mini_test/controller/templates/controller_test.rb", "lib/generators/mini_test/helper/helper_generator.rb", "lib/generators/mini_test/helper/templates/helper_spec.rb", "lib/generators/mini_test/helper/templates/helper_test.rb", "lib/generators/mini_test/install/install_generator.rb", "lib/generators/mini_test/install/templates/test/minitest_helper.rb", "lib/generators/mini_test/integration/integration_generator.rb", "lib/generators/mini_test/integration/templates/integration_spec.rb", "lib/generators/mini_test/integration/templates/integration_test.rb", "lib/generators/mini_test/mailer/mailer_generator.rb", "lib/generators/mini_test/mailer/templates/mailer_spec.rb", "lib/generators/mini_test/mailer/templates/mailer_test.rb", "lib/generators/mini_test/model/model_generator.rb", "lib/generators/mini_test/model/templates/fixtures.yml", "lib/generators/mini_test/model/templates/model_spec.rb", "lib/generators/mini_test/model/templates/model_test.rb", "lib/generators/mini_test/scaffold/scaffold_generator.rb", "lib/generators/mini_test/scaffold/templates/controller_spec.rb", "lib/generators/mini_test/scaffold/templates/controller_test.rb", "lib/minitest-rails.rb", "lib/minitest/rails.rb", "lib/minitest/rails/action_controller.rb", "lib/minitest/rails/action_dispatch.rb", "lib/minitest/rails/action_mailer.rb", "lib/minitest/rails/action_view.rb", "lib/minitest/rails/active_support.rb", "lib/minitest/rails/declarative.rb", "lib/minitest/rails/mochaing.rb", "lib/minitest/rails/tasks/minitest.rake", "lib/minitest/rails/tasks/sub_test_task.rb", "minitest-rails.gemspec", "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_scaffold_generator.rb", "test/rails/action_controller/test_controller_lookup.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/test_action_dispatch_spec_type.rb", "test/rails/test_action_mailer_spec_type.rb", "test/rails/test_action_view_spec_type.rb", "test/
|
13
|
+
s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/3.0.gemfile", "gemfiles/3.0.gemfile.lock", "gemfiles/3.1.gemfile", "gemfiles/3.1.gemfile.lock", "gemfiles/3.2.gemfile", "gemfiles/3.2.gemfile.lock", "gemfiles/minitest_tu_shim.rb", "lib/autotest/discover.rb", "lib/autotest/fixtures.rb", "lib/autotest/migrate.rb", "lib/autotest/minitest_rails.rb", "lib/generators/mini_test.rb", "lib/generators/mini_test/controller/controller_generator.rb", "lib/generators/mini_test/controller/templates/controller_spec.rb", "lib/generators/mini_test/controller/templates/controller_test.rb", "lib/generators/mini_test/helper/helper_generator.rb", "lib/generators/mini_test/helper/templates/helper_spec.rb", "lib/generators/mini_test/helper/templates/helper_test.rb", "lib/generators/mini_test/install/install_generator.rb", "lib/generators/mini_test/install/templates/test/minitest_helper.rb", "lib/generators/mini_test/integration/integration_generator.rb", "lib/generators/mini_test/integration/templates/integration_spec.rb", "lib/generators/mini_test/integration/templates/integration_test.rb", "lib/generators/mini_test/mailer/mailer_generator.rb", "lib/generators/mini_test/mailer/templates/mailer_spec.rb", "lib/generators/mini_test/mailer/templates/mailer_test.rb", "lib/generators/mini_test/model/model_generator.rb", "lib/generators/mini_test/model/templates/fixtures.yml", "lib/generators/mini_test/model/templates/model_spec.rb", "lib/generators/mini_test/model/templates/model_test.rb", "lib/generators/mini_test/scaffold/scaffold_generator.rb", "lib/generators/mini_test/scaffold/templates/controller_spec.rb", "lib/generators/mini_test/scaffold/templates/controller_test.rb", "lib/minitest-rails.rb", "lib/minitest/rails.rb", "lib/minitest/rails/action_controller.rb", "lib/minitest/rails/action_dispatch.rb", "lib/minitest/rails/action_mailer.rb", "lib/minitest/rails/action_view.rb", "lib/minitest/rails/active_support.rb", "lib/minitest/rails/declarative.rb", "lib/minitest/rails/mochaing.rb", "lib/minitest/rails/tasks/minitest.rake", "lib/minitest/rails/tasks/sub_test_task.rb", "minitest-rails.gemspec", "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_scaffold_generator.rb", "test/rails/action_controller/test_controller_lookup.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/test_action_dispatch_spec_type.rb", "test/rails/test_action_mailer_spec_type.rb", "test/rails/test_action_view_spec_type.rb", "test/rails/test_active_support_spec_type.rb", "test/test_sanity.rb"]
|
14
14
|
s.homepage = "http://blowmage.com/minitest-rails"
|
15
15
|
s.rdoc_options = ["--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = "minitest-rails"
|
18
18
|
s.rubygems_version = "1.8.24"
|
19
19
|
s.summary = "MiniTest integration for Rails 3.x"
|
20
|
-
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_scaffold_generator.rb", "test/rails/action_controller/test_controller_lookup.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/test_action_dispatch_spec_type.rb", "test/rails/test_action_mailer_spec_type.rb", "test/rails/test_action_view_spec_type.rb", "test/
|
20
|
+
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_scaffold_generator.rb", "test/rails/action_controller/test_controller_lookup.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/test_action_dispatch_spec_type.rb", "test/rails/test_action_mailer_spec_type.rb", "test/rails/test_action_view_spec_type.rb", "test/rails/test_active_support_spec_type.rb", "test/test_sanity.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
-
s.add_runtime_dependency(%q<minitest>, ["~> 3.
|
26
|
+
s.add_runtime_dependency(%q<minitest>, ["~> 3.4"])
|
27
27
|
s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
|
28
28
|
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
29
29
|
s.add_development_dependency(%q<fakefs>, ["~> 0.4"])
|
30
30
|
s.add_development_dependency(%q<hoe>, ["~> 3.0"])
|
31
31
|
else
|
32
|
-
s.add_dependency(%q<minitest>, ["~> 3.
|
32
|
+
s.add_dependency(%q<minitest>, ["~> 3.4"])
|
33
33
|
s.add_dependency(%q<rails>, ["~> 3.0"])
|
34
34
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
35
35
|
s.add_dependency(%q<fakefs>, ["~> 0.4"])
|
36
36
|
s.add_dependency(%q<hoe>, ["~> 3.0"])
|
37
37
|
end
|
38
38
|
else
|
39
|
-
s.add_dependency(%q<minitest>, ["~> 3.
|
39
|
+
s.add_dependency(%q<minitest>, ["~> 3.4"])
|
40
40
|
s.add_dependency(%q<rails>, ["~> 3.0"])
|
41
41
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
42
42
|
s.add_dependency(%q<fakefs>, ["~> 0.4"])
|
@@ -8,26 +8,34 @@ class ApplicationController < ActionController::Base; end
|
|
8
8
|
class ModelsController < ApplicationController; end
|
9
9
|
|
10
10
|
class TestApplicationControllerSpecType < MiniTest::Unit::TestCase
|
11
|
+
def assert_controller actual
|
12
|
+
assert_equal MiniTest::Rails::ActionController::TestCase, actual
|
13
|
+
end
|
14
|
+
|
15
|
+
def refute_controller actual
|
16
|
+
refute_equal MiniTest::Rails::ActionController::TestCase, actual
|
17
|
+
end
|
18
|
+
|
11
19
|
def test_spec_type_resolves_for_class_constants
|
12
|
-
|
13
|
-
|
20
|
+
assert_controller MiniTest::Spec.spec_type(ApplicationController)
|
21
|
+
assert_controller MiniTest::Spec.spec_type(ModelsController)
|
14
22
|
end
|
15
23
|
|
16
24
|
def test_spec_type_resolves_for_matching_strings
|
17
|
-
|
18
|
-
|
19
|
-
|
25
|
+
assert_controller MiniTest::Spec.spec_type("WidgetController")
|
26
|
+
assert_controller MiniTest::Spec.spec_type("WidgetControllerTest")
|
27
|
+
assert_controller MiniTest::Spec.spec_type("Widget Controller Test")
|
20
28
|
# And is not case sensitive
|
21
|
-
|
22
|
-
|
23
|
-
|
29
|
+
assert_controller MiniTest::Spec.spec_type("widgetcontroller")
|
30
|
+
assert_controller MiniTest::Spec.spec_type("widgetcontrollertest")
|
31
|
+
assert_controller MiniTest::Spec.spec_type("widget controller test")
|
24
32
|
end
|
25
33
|
|
26
34
|
def test_spec_type_wont_match_non_space_characters
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
35
|
+
refute_controller MiniTest::Spec.spec_type("Widget Controller\tTest")
|
36
|
+
refute_controller MiniTest::Spec.spec_type("Widget Controller\rTest")
|
37
|
+
refute_controller MiniTest::Spec.spec_type("Widget Controller\nTest")
|
38
|
+
refute_controller MiniTest::Spec.spec_type("Widget Controller\fTest")
|
39
|
+
refute_controller MiniTest::Spec.spec_type("Widget ControllerXTest")
|
32
40
|
end
|
33
41
|
end
|
@@ -4,29 +4,37 @@ require "rails"
|
|
4
4
|
require "minitest/rails/action_dispatch"
|
5
5
|
|
6
6
|
class TestActionDispatchSpecType < MiniTest::Unit::TestCase
|
7
|
+
def assert_dispatch actual
|
8
|
+
assert_equal MiniTest::Rails::ActionDispatch::IntegrationTest, actual
|
9
|
+
end
|
10
|
+
|
11
|
+
def refute_dispatch actual
|
12
|
+
refute_equal MiniTest::Rails::ActionDispatch::IntegrationTest, actual
|
13
|
+
end
|
14
|
+
|
7
15
|
def test_spec_type_resolves_for_matching_acceptance_strings
|
8
|
-
|
9
|
-
|
16
|
+
assert_dispatch MiniTest::Spec.spec_type("WidgetAcceptanceTest")
|
17
|
+
assert_dispatch MiniTest::Spec.spec_type("Widget Acceptance Test")
|
10
18
|
# And is not case sensitive
|
11
|
-
|
12
|
-
|
19
|
+
assert_dispatch MiniTest::Spec.spec_type("widgetacceptancetest")
|
20
|
+
assert_dispatch MiniTest::Spec.spec_type("widget acceptance test")
|
13
21
|
end
|
14
22
|
|
15
23
|
def test_spec_type_wont_match_non_space_characters_acceptance
|
16
|
-
|
17
|
-
|
24
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\tTest")
|
25
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\rTest")
|
18
26
|
# TODO: Update regex so that new lines don't match.
|
19
|
-
|
20
|
-
|
21
|
-
|
27
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\nTest")
|
28
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\fTest")
|
29
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget AcceptanceXTest")
|
22
30
|
end
|
23
31
|
|
24
32
|
def test_spec_type_resolves_for_matching_integration_strings
|
25
|
-
|
26
|
-
|
33
|
+
assert_dispatch MiniTest::Spec.spec_type("WidgetIntegrationTest")
|
34
|
+
assert_dispatch MiniTest::Spec.spec_type("Widget Integration Test")
|
27
35
|
# And is not case sensitive
|
28
|
-
|
29
|
-
|
36
|
+
assert_dispatch MiniTest::Spec.spec_type("widgetintegrationtest")
|
37
|
+
assert_dispatch MiniTest::Spec.spec_type("widget integration test")
|
30
38
|
end
|
31
39
|
|
32
40
|
def test_spec_type_wont_match_non_space_characters_integration
|
@@ -9,26 +9,34 @@ class NotificationMailer < ActionMailer::Base; end
|
|
9
9
|
class Notifications < ActionMailer::Base; end
|
10
10
|
|
11
11
|
class TestActionMailerSpecType < MiniTest::Unit::TestCase
|
12
|
+
def assert_mailer actual
|
13
|
+
assert_equal MiniTest::Rails::ActionMailer::TestCase, actual
|
14
|
+
end
|
15
|
+
|
16
|
+
def refute_mailer actual
|
17
|
+
refute_equal MiniTest::Rails::ActionMailer::TestCase, actual
|
18
|
+
end
|
19
|
+
|
12
20
|
def test_spec_type_resolves_for_class_constants
|
13
|
-
|
14
|
-
|
21
|
+
assert_mailer MiniTest::Spec.spec_type(NotificationMailer)
|
22
|
+
assert_mailer MiniTest::Spec.spec_type(Notifications)
|
15
23
|
end
|
16
24
|
|
17
25
|
def test_spec_type_resolves_for_matching_strings
|
18
|
-
|
19
|
-
|
20
|
-
|
26
|
+
assert_mailer MiniTest::Spec.spec_type("WidgetMailer")
|
27
|
+
assert_mailer MiniTest::Spec.spec_type("WidgetMailerTest")
|
28
|
+
assert_mailer MiniTest::Spec.spec_type("Widget Mailer Test")
|
21
29
|
# And is not case sensitive
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
assert_mailer MiniTest::Spec.spec_type("widgetmailer")
|
31
|
+
assert_mailer MiniTest::Spec.spec_type("widgetmailertest")
|
32
|
+
assert_mailer MiniTest::Spec.spec_type("widget mailer test")
|
25
33
|
end
|
26
34
|
|
27
35
|
def test_spec_type_wont_match_non_space_characters
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
36
|
+
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\tTest")
|
37
|
+
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\rTest")
|
38
|
+
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\nTest")
|
39
|
+
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\fTest")
|
40
|
+
refute_mailer MiniTest::Spec.spec_type("Widget MailerXTest")
|
33
41
|
end
|
34
42
|
end
|
@@ -4,21 +4,39 @@ require "rails"
|
|
4
4
|
require "minitest/rails/action_view"
|
5
5
|
|
6
6
|
class TestActionViewSpecType < MiniTest::Unit::TestCase
|
7
|
-
def
|
8
|
-
assert_equal MiniTest::
|
9
|
-
|
10
|
-
|
7
|
+
def assert_view actual
|
8
|
+
assert_equal MiniTest::Rails::ActionView::TestCase, actual
|
9
|
+
end
|
10
|
+
|
11
|
+
def refute_view actual
|
12
|
+
refute_equal MiniTest::Rails::ActionView::TestCase, actual
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_spec_type_resolves_for_matching_helper_strings
|
16
|
+
assert_view MiniTest::Spec.spec_type("WidgetHelper")
|
17
|
+
assert_view MiniTest::Spec.spec_type("WidgetHelperTest")
|
18
|
+
assert_view MiniTest::Spec.spec_type("Widget Helper Test")
|
19
|
+
# And is not case sensitive
|
20
|
+
assert_view MiniTest::Spec.spec_type("widgethelper")
|
21
|
+
assert_view MiniTest::Spec.spec_type("widgethelpertest")
|
22
|
+
assert_view MiniTest::Spec.spec_type("widget helper test")
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_spec_type_resolves_for_matching_view_strings
|
26
|
+
assert_view MiniTest::Spec.spec_type("WidgetView")
|
27
|
+
assert_view MiniTest::Spec.spec_type("WidgetViewTest")
|
28
|
+
assert_view MiniTest::Spec.spec_type("Widget View Test")
|
11
29
|
# And is not case sensitive
|
12
|
-
|
13
|
-
|
14
|
-
|
30
|
+
assert_view MiniTest::Spec.spec_type("widgetview")
|
31
|
+
assert_view MiniTest::Spec.spec_type("widgetviewtest")
|
32
|
+
assert_view MiniTest::Spec.spec_type("widget view test")
|
15
33
|
end
|
16
34
|
|
17
35
|
def test_spec_type_wont_match_non_space_characters
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
36
|
+
refute_view MiniTest::Spec.spec_type("Widget Helper\tTest")
|
37
|
+
refute_view MiniTest::Spec.spec_type("Widget Helper\rTest")
|
38
|
+
refute_view MiniTest::Spec.spec_type("Widget Helper\nTest")
|
39
|
+
refute_view MiniTest::Spec.spec_type("Widget Helper\fTest")
|
40
|
+
refute_view MiniTest::Spec.spec_type("Widget HelperXTest")
|
23
41
|
end
|
24
42
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "rails"
|
3
|
+
|
4
|
+
require "active_record"
|
5
|
+
load "minitest/rails/active_support.rb" # Force reload
|
6
|
+
# Not sure why we need to reload, but we do...
|
7
|
+
|
8
|
+
class SomeRandomModel < ActiveRecord::Base; end
|
9
|
+
|
10
|
+
class TestActiveSupportSpecType < MiniTest::Unit::TestCase
|
11
|
+
|
12
|
+
def assert_support actual
|
13
|
+
assert_equal MiniTest::Rails::ActiveSupport::TestCase, actual
|
14
|
+
end
|
15
|
+
|
16
|
+
def assert_spec actual
|
17
|
+
assert_equal MiniTest::Spec, actual
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_spec_type_resolves_for_actitive_record_constants
|
21
|
+
assert_support MiniTest::Spec.spec_type(SomeRandomModel)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_spec_type_doesnt_resolve_random_strings
|
25
|
+
assert_spec MiniTest::Spec.spec_type("Unmatched String")
|
26
|
+
end
|
27
|
+
end
|
File without changes
|
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: 0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '3.
|
21
|
+
version: '3.4'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '3.
|
29
|
+
version: '3.4'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rails
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +116,10 @@ files:
|
|
116
116
|
- gemfiles/3.2.gemfile
|
117
117
|
- gemfiles/3.2.gemfile.lock
|
118
118
|
- gemfiles/minitest_tu_shim.rb
|
119
|
+
- lib/autotest/discover.rb
|
120
|
+
- lib/autotest/fixtures.rb
|
121
|
+
- lib/autotest/migrate.rb
|
122
|
+
- lib/autotest/minitest_rails.rb
|
119
123
|
- lib/generators/mini_test.rb
|
120
124
|
- lib/generators/mini_test/controller/controller_generator.rb
|
121
125
|
- lib/generators/mini_test/controller/templates/controller_spec.rb
|
@@ -162,7 +166,8 @@ files:
|
|
162
166
|
- test/rails/test_action_dispatch_spec_type.rb
|
163
167
|
- test/rails/test_action_mailer_spec_type.rb
|
164
168
|
- test/rails/test_action_view_spec_type.rb
|
165
|
-
- test/
|
169
|
+
- test/rails/test_active_support_spec_type.rb
|
170
|
+
- test/test_sanity.rb
|
166
171
|
homepage: http://blowmage.com/minitest-rails
|
167
172
|
licenses: []
|
168
173
|
post_install_message:
|
@@ -202,4 +207,5 @@ test_files:
|
|
202
207
|
- test/rails/test_action_dispatch_spec_type.rb
|
203
208
|
- test/rails/test_action_mailer_spec_type.rb
|
204
209
|
- test/rails/test_action_view_spec_type.rb
|
205
|
-
- test/
|
210
|
+
- test/rails/test_active_support_spec_type.rb
|
211
|
+
- test/test_sanity.rb
|