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,11 +1,11 @@
|
|
1
1
|
require "helper"
|
2
|
-
require "generators/
|
2
|
+
require "generators/minitest/helper/helper_generator"
|
3
3
|
|
4
4
|
class TestHelperGenerator < GeneratorTest
|
5
5
|
|
6
6
|
def test_helper_generator
|
7
7
|
assert_output(/create test\/helpers\/user_helper_test.rb/m) do
|
8
|
-
|
8
|
+
Minitest::Generators::HelperGenerator.start ["user"]
|
9
9
|
end
|
10
10
|
assert File.exists? "test/helpers/user_helper_test.rb"
|
11
11
|
contents = File.read "test/helpers/user_helper_test.rb"
|
@@ -14,7 +14,7 @@ class TestHelperGenerator < GeneratorTest
|
|
14
14
|
|
15
15
|
def test_namespaced_helper_generator
|
16
16
|
assert_output(/create test\/helpers\/admin\/user_helper_test.rb/m) do
|
17
|
-
|
17
|
+
Minitest::Generators::HelperGenerator.start ["admin/user"]
|
18
18
|
end
|
19
19
|
assert File.exists? "test/helpers/admin/user_helper_test.rb"
|
20
20
|
contents = File.read "test/helpers/admin/user_helper_test.rb"
|
@@ -23,7 +23,7 @@ class TestHelperGenerator < GeneratorTest
|
|
23
23
|
|
24
24
|
def test_helper_generator_spec
|
25
25
|
assert_output(/create test\/helpers\/user_helper_test.rb/m) do
|
26
|
-
|
26
|
+
Minitest::Generators::HelperGenerator.start ["user", "--spec"]
|
27
27
|
end
|
28
28
|
assert File.exists? "test/helpers/user_helper_test.rb"
|
29
29
|
contents = File.read "test/helpers/user_helper_test.rb"
|
@@ -32,7 +32,7 @@ class TestHelperGenerator < GeneratorTest
|
|
32
32
|
|
33
33
|
def test_namespaced_helper_generator_spec
|
34
34
|
assert_output(/create test\/helpers\/admin\/user_helper_test.rb/m) do
|
35
|
-
|
35
|
+
Minitest::Generators::HelperGenerator.start ["admin/user", "--spec"]
|
36
36
|
end
|
37
37
|
assert File.exists? "test/helpers/admin/user_helper_test.rb"
|
38
38
|
contents = File.read "test/helpers/admin/user_helper_test.rb"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "helper"
|
2
|
-
require "generators/
|
2
|
+
require "generators/minitest/install/install_generator"
|
3
3
|
|
4
4
|
class TestInstallGenerator < GeneratorTest
|
5
5
|
|
6
6
|
def test_install_generator
|
7
7
|
assert_output(/create test\/test_helper.rb/m) do
|
8
|
-
|
8
|
+
Minitest::Generators::InstallGenerator.start
|
9
9
|
end
|
10
10
|
assert File.exists? "test/test_helper.rb"
|
11
11
|
contents = File.read "test/test_helper.rb"
|
@@ -21,7 +21,7 @@ class TestInstallGenerator < GeneratorTest
|
|
21
21
|
|
22
22
|
def test_install_generator_without_active_record
|
23
23
|
assert_output(/create test\/test_helper.rb/m) do
|
24
|
-
|
24
|
+
Minitest::Generators::InstallGenerator.start ["--skip-active-record"]
|
25
25
|
end
|
26
26
|
assert File.exists? "test/test_helper.rb"
|
27
27
|
contents = File.read "test/test_helper.rb"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "helper"
|
2
|
-
require "generators/
|
2
|
+
require "generators/minitest/mailer/mailer_generator"
|
3
3
|
|
4
4
|
class TestMailerGenerator < GeneratorTest
|
5
5
|
|
6
6
|
def test_mailer_generator
|
7
7
|
assert_output(/create test\/mailers\/notification_test.rb/m) do
|
8
|
-
|
8
|
+
Minitest::Generators::MailerGenerator.start ["notification"]
|
9
9
|
end
|
10
10
|
assert File.exists? "test/mailers/notification_test.rb"
|
11
11
|
contents = File.read "test/mailers/notification_test.rb"
|
@@ -14,7 +14,7 @@ class TestMailerGenerator < GeneratorTest
|
|
14
14
|
|
15
15
|
def test_namespaced_mailer_generator
|
16
16
|
assert_output(/create test\/mailers\/admin\/notification_test.rb/m) do
|
17
|
-
|
17
|
+
Minitest::Generators::MailerGenerator.start ["admin/notification"]
|
18
18
|
end
|
19
19
|
assert File.exists? "test/mailers/admin/notification_test.rb"
|
20
20
|
contents = File.read "test/mailers/admin/notification_test.rb"
|
@@ -23,7 +23,7 @@ class TestMailerGenerator < GeneratorTest
|
|
23
23
|
|
24
24
|
def test_mailer_generator_spec
|
25
25
|
assert_output(/create test\/mailers\/notification_test.rb/m) do
|
26
|
-
|
26
|
+
Minitest::Generators::MailerGenerator.start ["notification", "welcome", "--spec"]
|
27
27
|
end
|
28
28
|
assert File.exists? "test/mailers/notification_test.rb"
|
29
29
|
contents = File.read "test/mailers/notification_test.rb"
|
@@ -32,7 +32,7 @@ class TestMailerGenerator < GeneratorTest
|
|
32
32
|
|
33
33
|
def test_namespaced_mailer_generator_spec
|
34
34
|
assert_output(/create test\/mailers\/admin\/notification_test.rb/m) do
|
35
|
-
|
35
|
+
Minitest::Generators::MailerGenerator.start ["admin/notification", "welcome", "--spec"]
|
36
36
|
end
|
37
37
|
assert File.exists? "test/mailers/admin/notification_test.rb"
|
38
38
|
contents = File.read "test/mailers/admin/notification_test.rb"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "helper"
|
2
|
-
require "generators/
|
2
|
+
require "generators/minitest/model/model_generator"
|
3
3
|
|
4
4
|
class TestModelGenerator < GeneratorTest
|
5
5
|
|
6
6
|
def test_model_generator
|
7
7
|
assert_output(/create test\/models\/user_test.rb/m) do
|
8
|
-
|
8
|
+
Minitest::Generators::ModelGenerator.start ["user"]
|
9
9
|
end
|
10
10
|
assert File.exists? "test/models/user_test.rb"
|
11
11
|
contents = File.read "test/models/user_test.rb"
|
@@ -14,7 +14,7 @@ class TestModelGenerator < GeneratorTest
|
|
14
14
|
|
15
15
|
def test_namespaced_model_generator
|
16
16
|
assert_output(/create test\/models\/admin\/user_test.rb/m) do
|
17
|
-
|
17
|
+
Minitest::Generators::ModelGenerator.start ["admin/user"]
|
18
18
|
end
|
19
19
|
assert File.exists? "test/models/admin/user_test.rb"
|
20
20
|
contents = File.read "test/models/admin/user_test.rb"
|
@@ -26,7 +26,7 @@ class TestModelGenerator < GeneratorTest
|
|
26
26
|
Rails::Generators.namespace = TestApp
|
27
27
|
|
28
28
|
assert_output(/create test\/models\/test_app\/user_test.rb/m) do
|
29
|
-
|
29
|
+
Minitest::Generators::ModelGenerator.start ["user"]
|
30
30
|
end
|
31
31
|
assert File.exists? "test/models/test_app/user_test.rb"
|
32
32
|
contents = File.read "test/models/test_app/user_test.rb"
|
@@ -39,7 +39,7 @@ class TestModelGenerator < GeneratorTest
|
|
39
39
|
|
40
40
|
def test_model_generator_spec
|
41
41
|
assert_output(/create test\/models\/user_test.rb/m) do
|
42
|
-
|
42
|
+
Minitest::Generators::ModelGenerator.start ["user", "--spec"]
|
43
43
|
end
|
44
44
|
assert File.exists? "test/models/user_test.rb"
|
45
45
|
assert File.exists? "test/fixtures/users.yml"
|
@@ -49,7 +49,7 @@ class TestModelGenerator < GeneratorTest
|
|
49
49
|
|
50
50
|
def test_namespaced_model_generator_spec
|
51
51
|
assert_output(/create test\/models\/admin\/user_test.rb/m) do
|
52
|
-
|
52
|
+
Minitest::Generators::ModelGenerator.start ["admin/user", "--spec"]
|
53
53
|
end
|
54
54
|
assert File.exists? "test/models/admin/user_test.rb"
|
55
55
|
contents = File.read "test/models/admin/user_test.rb"
|
@@ -58,21 +58,21 @@ class TestModelGenerator < GeneratorTest
|
|
58
58
|
|
59
59
|
def test_model_generator_fixture
|
60
60
|
assert_output(/create test\/fixtures\/users.yml/m) do
|
61
|
-
|
61
|
+
Minitest::Generators::ModelGenerator.start ["user"]
|
62
62
|
end
|
63
63
|
assert File.exists? "test/fixtures/users.yml"
|
64
64
|
end
|
65
65
|
|
66
66
|
def test_namespaced_model_generator_fixture
|
67
67
|
assert_output(/create test\/fixtures\/admin\/users.yml/m) do
|
68
|
-
|
68
|
+
Minitest::Generators::ModelGenerator.start ["admin/user"]
|
69
69
|
end
|
70
70
|
assert File.exists? "test/fixtures/admin/users.yml"
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_model_generator_skip_fixture
|
74
74
|
out, _ = capture_io do
|
75
|
-
|
75
|
+
Minitest::Generators::ModelGenerator.start ["user", "--skip-fixture"]
|
76
76
|
end
|
77
77
|
refute_match(/create test\/fixtures\/users.yml/m, out)
|
78
78
|
refute File.exists? "test/fixtures/users.yml"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "helper"
|
2
|
-
require "generators/
|
2
|
+
require "generators/minitest/route/route_generator"
|
3
3
|
|
4
4
|
class TestRouteGenerator < GeneratorTest
|
5
5
|
|
6
6
|
def test_route_generator
|
7
7
|
assert_output(/create test\/routes\/route_test.rb/m) do
|
8
|
-
|
8
|
+
Minitest::Generators::RouteGenerator.start
|
9
9
|
end
|
10
10
|
assert File.exists? "test/routes/route_test.rb"
|
11
11
|
contents = File.read "test/routes/route_test.rb"
|
@@ -14,7 +14,7 @@ class TestRouteGenerator < GeneratorTest
|
|
14
14
|
|
15
15
|
def test_route_generator_spec
|
16
16
|
assert_output(/create test\/routes\/route_test.rb/m) do
|
17
|
-
|
17
|
+
Minitest::Generators::RouteGenerator.start ["--spec"]
|
18
18
|
end
|
19
19
|
assert File.exists? "test/routes/route_test.rb"
|
20
20
|
contents = File.read "test/routes/route_test.rb"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "helper"
|
2
|
-
require "generators/
|
2
|
+
require "generators/minitest/scaffold/scaffold_generator"
|
3
3
|
|
4
4
|
class TestScaffoldGenerator < GeneratorTest
|
5
5
|
|
6
6
|
def test_scaffold_generator
|
7
7
|
assert_output(/create test\/controllers\/users_controller_test.rb/m) do
|
8
|
-
|
8
|
+
Minitest::Generators::ScaffoldGenerator.start ["user"]
|
9
9
|
end
|
10
10
|
assert File.exists? "test/controllers/users_controller_test.rb"
|
11
11
|
contents = File.read "test/controllers/users_controller_test.rb"
|
@@ -14,7 +14,7 @@ class TestScaffoldGenerator < GeneratorTest
|
|
14
14
|
|
15
15
|
def test_scaffold_generator_spec
|
16
16
|
assert_output(/create test\/controllers\/users_controller_test.rb/m) do
|
17
|
-
|
17
|
+
Minitest::Generators::ScaffoldGenerator.start ["user", "--spec"]
|
18
18
|
end
|
19
19
|
assert File.exists? "test/controllers/users_controller_test.rb"
|
20
20
|
contents = File.read "test/controllers/users_controller_test.rb"
|
data/test/helper.rb
CHANGED
@@ -3,6 +3,7 @@ require "minitest/autorun"
|
|
3
3
|
require "rails"
|
4
4
|
require "rails/generators"
|
5
5
|
|
6
|
+
require "sqlite3"
|
6
7
|
require "active_record"
|
7
8
|
|
8
9
|
require "action_controller"
|
@@ -22,7 +23,7 @@ class FakeFS::File
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
|
-
class GeneratorTest <
|
26
|
+
class GeneratorTest < Minitest::Test
|
26
27
|
def setup
|
27
28
|
Rails::Generators.no_color!
|
28
29
|
FakeFS.activate!
|
@@ -61,3 +62,5 @@ TestApp::Application.routes.draw do
|
|
61
62
|
resources :widgets
|
62
63
|
end
|
63
64
|
end
|
65
|
+
|
66
|
+
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
@@ -3,7 +3,7 @@ require "helper"
|
|
3
3
|
class ApplicationController < ActionController::Base; end
|
4
4
|
class ModelsController < ApplicationController; end
|
5
5
|
|
6
|
-
class TestApplicationControllerSpecType <
|
6
|
+
class TestApplicationControllerSpecType < Minitest::Test
|
7
7
|
def assert_controller actual
|
8
8
|
assert_equal ActionController::TestCase, actual
|
9
9
|
end
|
@@ -13,25 +13,30 @@ class TestApplicationControllerSpecType < MiniTest::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_spec_type_resolves_for_class_constants
|
16
|
-
assert_controller
|
17
|
-
assert_controller
|
16
|
+
assert_controller Minitest::Spec.spec_type(ApplicationController)
|
17
|
+
assert_controller Minitest::Spec.spec_type(ModelsController)
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_spec_type_resolves_for_matching_strings
|
21
|
-
assert_controller
|
22
|
-
assert_controller
|
23
|
-
assert_controller
|
21
|
+
assert_controller Minitest::Spec.spec_type("WidgetController")
|
22
|
+
assert_controller Minitest::Spec.spec_type("WidgetControllerTest")
|
23
|
+
assert_controller Minitest::Spec.spec_type("Widget Controller Test")
|
24
24
|
# And is not case sensitive
|
25
|
-
assert_controller
|
26
|
-
assert_controller
|
27
|
-
assert_controller
|
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")
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_spec_type_wont_match_non_space_characters
|
31
|
-
refute_controller
|
32
|
-
refute_controller
|
33
|
-
refute_controller
|
34
|
-
refute_controller
|
35
|
-
refute_controller
|
31
|
+
refute_controller Minitest::Spec.spec_type("Widget Controller\tTest")
|
32
|
+
refute_controller Minitest::Spec.spec_type("Widget Controller\rTest")
|
33
|
+
refute_controller Minitest::Spec.spec_type("Widget Controller\nTest")
|
34
|
+
refute_controller Minitest::Spec.spec_type("Widget Controller\fTest")
|
35
|
+
refute_controller Minitest::Spec.spec_type("Widget ControllerXTest")
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_spec_type_resolves_for_additional_desc_controller
|
39
|
+
refute_controller Minitest::Spec.spec_type("Unmatched String")
|
40
|
+
assert_controller Minitest::Spec.spec_type(["Unmatched String", :controller])
|
36
41
|
end
|
37
42
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
class TestActionDispatchSpecType <
|
3
|
+
class TestActionDispatchSpecType < Minitest::Test
|
4
4
|
def assert_dispatch actual
|
5
5
|
assert_equal ActionDispatch::IntegrationTest, actual
|
6
6
|
end
|
@@ -10,44 +10,47 @@ class TestActionDispatchSpecType < MiniTest::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_spec_type_resolves_for_matching_acceptance_strings
|
13
|
-
assert_dispatch
|
14
|
-
assert_dispatch
|
15
|
-
assert_dispatch
|
16
|
-
assert_dispatch
|
13
|
+
assert_dispatch Minitest::Spec.spec_type("WidgetAcceptanceTest")
|
14
|
+
assert_dispatch Minitest::Spec.spec_type("Widget Acceptance Test")
|
15
|
+
assert_dispatch Minitest::Spec.spec_type("WidgetAcceptance")
|
16
|
+
assert_dispatch Minitest::Spec.spec_type("Widget Acceptance")
|
17
17
|
# And is not case sensitive
|
18
|
-
assert_dispatch
|
19
|
-
assert_dispatch
|
20
|
-
assert_dispatch
|
21
|
-
assert_dispatch
|
18
|
+
assert_dispatch Minitest::Spec.spec_type("widgetacceptancetest")
|
19
|
+
assert_dispatch Minitest::Spec.spec_type("widget acceptance test")
|
20
|
+
assert_dispatch Minitest::Spec.spec_type("widgetacceptance")
|
21
|
+
assert_dispatch Minitest::Spec.spec_type("widget acceptance")
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_spec_type_wont_match_non_space_characters_acceptance
|
25
|
-
refute_dispatch
|
26
|
-
refute_dispatch
|
27
|
-
|
28
|
-
refute_dispatch
|
29
|
-
refute_dispatch
|
30
|
-
refute_dispatch MiniTest::Spec.spec_type("Widget AcceptanceXTest")
|
25
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Acceptance\tTest")
|
26
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Acceptance\rTest")
|
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")
|
31
30
|
end
|
32
31
|
|
33
32
|
def test_spec_type_resolves_for_matching_integration_strings
|
34
|
-
assert_dispatch
|
35
|
-
assert_dispatch
|
36
|
-
assert_dispatch
|
37
|
-
assert_dispatch
|
33
|
+
assert_dispatch Minitest::Spec.spec_type("WidgetIntegrationTest")
|
34
|
+
assert_dispatch Minitest::Spec.spec_type("Widget Integration Test")
|
35
|
+
assert_dispatch Minitest::Spec.spec_type("WidgetIntegration")
|
36
|
+
assert_dispatch Minitest::Spec.spec_type("Widget Integration")
|
38
37
|
# And is not case sensitive
|
39
|
-
assert_dispatch
|
40
|
-
assert_dispatch
|
41
|
-
assert_dispatch
|
42
|
-
assert_dispatch
|
38
|
+
assert_dispatch Minitest::Spec.spec_type("widgetintegrationtest")
|
39
|
+
assert_dispatch Minitest::Spec.spec_type("widget integration test")
|
40
|
+
assert_dispatch Minitest::Spec.spec_type("widgetintegration")
|
41
|
+
assert_dispatch Minitest::Spec.spec_type("widget integration")
|
43
42
|
end
|
44
43
|
|
45
44
|
def test_spec_type_wont_match_non_space_characters_integration
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Integration\tTest")
|
46
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Integration\rTest")
|
47
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Integration\nTest")
|
48
|
+
refute_dispatch Minitest::Spec.spec_type("Widget Integration\fTest")
|
49
|
+
refute_dispatch Minitest::Spec.spec_type("Widget IntegrationXTest")
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_spec_type_resolves_for_additional_desc_integration
|
53
|
+
refute_dispatch Minitest::Spec.spec_type("Unmatched String")
|
54
|
+
assert_dispatch Minitest::Spec.spec_type(["Unmatched String", :integration])
|
52
55
|
end
|
53
56
|
end
|
@@ -3,7 +3,7 @@ require "helper"
|
|
3
3
|
class NotificationMailer < ActionMailer::Base; end
|
4
4
|
class Notifications < ActionMailer::Base; end
|
5
5
|
|
6
|
-
class TestActionMailerSpecType <
|
6
|
+
class TestActionMailerSpecType < Minitest::Test
|
7
7
|
def assert_mailer actual
|
8
8
|
assert_equal ActionMailer::TestCase, actual
|
9
9
|
end
|
@@ -13,25 +13,30 @@ class TestActionMailerSpecType < MiniTest::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_spec_type_resolves_for_class_constants
|
16
|
-
assert_mailer
|
17
|
-
assert_mailer
|
16
|
+
assert_mailer Minitest::Spec.spec_type(NotificationMailer)
|
17
|
+
assert_mailer Minitest::Spec.spec_type(Notifications)
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_spec_type_resolves_for_matching_strings
|
21
|
-
assert_mailer
|
22
|
-
assert_mailer
|
23
|
-
assert_mailer
|
21
|
+
assert_mailer Minitest::Spec.spec_type("WidgetMailer")
|
22
|
+
assert_mailer Minitest::Spec.spec_type("WidgetMailerTest")
|
23
|
+
assert_mailer Minitest::Spec.spec_type("Widget Mailer Test")
|
24
24
|
# And is not case sensitive
|
25
|
-
assert_mailer
|
26
|
-
assert_mailer
|
27
|
-
assert_mailer
|
25
|
+
assert_mailer Minitest::Spec.spec_type("widgetmailer")
|
26
|
+
assert_mailer Minitest::Spec.spec_type("widgetmailertest")
|
27
|
+
assert_mailer Minitest::Spec.spec_type("widget mailer test")
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_spec_type_wont_match_non_space_characters
|
31
|
-
refute_mailer
|
32
|
-
refute_mailer
|
33
|
-
refute_mailer
|
34
|
-
refute_mailer
|
35
|
-
refute_mailer
|
31
|
+
refute_mailer Minitest::Spec.spec_type("Widget Mailer\tTest")
|
32
|
+
refute_mailer Minitest::Spec.spec_type("Widget Mailer\rTest")
|
33
|
+
refute_mailer Minitest::Spec.spec_type("Widget Mailer\nTest")
|
34
|
+
refute_mailer Minitest::Spec.spec_type("Widget Mailer\fTest")
|
35
|
+
refute_mailer Minitest::Spec.spec_type("Widget MailerXTest")
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_spec_type_resolves_for_additional_desc_mailer
|
39
|
+
refute_mailer Minitest::Spec.spec_type("Unmatched String")
|
40
|
+
assert_mailer Minitest::Spec.spec_type(["Unmatched String", :mailer])
|
36
41
|
end
|
37
42
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
class TestActionViewSpecType <
|
3
|
+
class TestActionViewSpecType < Minitest::Test
|
4
4
|
def assert_view actual
|
5
5
|
assert_equal ActionView::TestCase, actual
|
6
6
|
end
|
@@ -10,33 +10,39 @@ class TestActionViewSpecType < MiniTest::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_spec_type_resolves_for_matching_helper_strings
|
13
|
-
assert_view
|
14
|
-
assert_view
|
15
|
-
assert_view
|
13
|
+
assert_view Minitest::Spec.spec_type("WidgetHelper")
|
14
|
+
assert_view Minitest::Spec.spec_type("WidgetHelperTest")
|
15
|
+
assert_view Minitest::Spec.spec_type("Widget Helper Test")
|
16
16
|
# And is not case sensitive
|
17
|
-
assert_view
|
18
|
-
assert_view
|
19
|
-
assert_view
|
17
|
+
assert_view Minitest::Spec.spec_type("widgethelper")
|
18
|
+
assert_view Minitest::Spec.spec_type("widgethelpertest")
|
19
|
+
assert_view Minitest::Spec.spec_type("widget helper test")
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_spec_type_resolves_for_matching_view_strings
|
23
|
-
assert_view
|
23
|
+
assert_view Minitest::Spec.spec_type("Widget View Test")
|
24
24
|
# And is not case sensitive
|
25
|
-
assert_view
|
25
|
+
assert_view Minitest::Spec.spec_type("widget view test")
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_spec_type_wont_match_models_that_end_in_view
|
29
|
-
refute_view
|
30
|
-
refute_view
|
31
|
-
refute_view
|
32
|
-
refute_view
|
29
|
+
refute_view Minitest::Spec.spec_type("NewsOverviewTest")
|
30
|
+
refute_view Minitest::Spec.spec_type("News Overview Test")
|
31
|
+
refute_view Minitest::Spec.spec_type("NewsOverview")
|
32
|
+
refute_view Minitest::Spec.spec_type("News Overview")
|
33
33
|
end
|
34
34
|
|
35
35
|
def test_spec_type_wont_match_non_space_characters
|
36
|
-
refute_view
|
37
|
-
refute_view
|
38
|
-
refute_view
|
39
|
-
refute_view
|
40
|
-
refute_view
|
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")
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_spec_type_resolves_for_additional_desc_view_or_helper
|
44
|
+
refute_view Minitest::Spec.spec_type("Unmatched String")
|
45
|
+
assert_view Minitest::Spec.spec_type(["Unmatched String", :view])
|
46
|
+
assert_view Minitest::Spec.spec_type(["Unmatched String", :helper])
|
41
47
|
end
|
42
48
|
end
|
@@ -2,34 +2,6 @@ require "helper"
|
|
2
2
|
|
3
3
|
class TestActiveSupportAssertions < ActiveSupport::TestCase
|
4
4
|
|
5
|
-
def test_assert_blank
|
6
|
-
assert_blank ""
|
7
|
-
assert_blank nil
|
8
|
-
assert_blank []
|
9
|
-
assert_blank Hash.new
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_refute_present
|
13
|
-
refute_present ""
|
14
|
-
refute_present nil
|
15
|
-
refute_present []
|
16
|
-
refute_present Hash.new
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_assert_present
|
20
|
-
assert_present "here"
|
21
|
-
assert_present Object.new
|
22
|
-
assert_present [1,2,3]
|
23
|
-
assert_present :key => :value
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_refute_blank
|
27
|
-
refute_blank "here"
|
28
|
-
refute_blank Object.new
|
29
|
-
refute_blank [1,2,3]
|
30
|
-
refute_blank :key => :value
|
31
|
-
end
|
32
|
-
|
33
5
|
def test_assert_difference
|
34
6
|
counter = 0
|
35
7
|
assert_difference "counter" do
|
@@ -3,34 +3,6 @@ require "helper"
|
|
3
3
|
# Can't use describe because there is no spec type to use
|
4
4
|
class TestActiveSupportExpectations < ActiveSupport::TestCase
|
5
5
|
|
6
|
-
def test_must_be_blank
|
7
|
-
"".must_be_blank
|
8
|
-
nil.must_be_blank
|
9
|
-
[].must_be_blank
|
10
|
-
Hash.new.must_be_blank
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_wont_be_present
|
14
|
-
"".wont_be_present
|
15
|
-
nil.wont_be_present
|
16
|
-
[].wont_be_present
|
17
|
-
Hash.new.wont_be_present
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_must_be_present
|
21
|
-
"here".must_be_present
|
22
|
-
Object.new.must_be_present
|
23
|
-
[1,2,3].must_be_present
|
24
|
-
{:key => :value}.must_be_present
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_wont_be_blank
|
28
|
-
"here".wont_be_blank
|
29
|
-
Object.new.wont_be_blank
|
30
|
-
[1,2,3].wont_be_blank
|
31
|
-
{:key => :value}.wont_be_blank
|
32
|
-
end
|
33
|
-
|
34
6
|
def test_must_change
|
35
7
|
counter = 0
|
36
8
|
|
@@ -2,21 +2,25 @@ require "helper"
|
|
2
2
|
|
3
3
|
class SomeRandomModel < ActiveRecord::Base; end
|
4
4
|
|
5
|
-
class TestActiveSupportSpecType <
|
5
|
+
class TestActiveSupportSpecType < Minitest::Test
|
6
6
|
|
7
7
|
def assert_support actual
|
8
8
|
assert_equal ActiveSupport::TestCase, actual
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
11
|
+
def refute_support actual
|
12
|
+
refute_equal ActiveSupport::TestCase, actual
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_spec_type_resolves_for_actitive_record_constants
|
16
|
-
assert_support
|
16
|
+
assert_support Minitest::Spec.spec_type(SomeRandomModel)
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_spec_type_doesnt_resolve_random_strings
|
20
|
-
|
20
|
+
refute_support Minitest::Spec.spec_type("Unmatched String")
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_spec_type_resolves_for_additional_desc_model
|
24
|
+
assert_support Minitest::Spec.spec_type(["Unmatched String", :model])
|
21
25
|
end
|
22
26
|
end
|