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 CHANGED
@@ -9,13 +9,7 @@ notifications:
9
9
  - mike@blowmage.com
10
10
  rvm:
11
11
  - 1.9.3
12
- - 1.9.2
13
- - jruby-18mode
14
- - jruby-19mode
15
- - rbx-18mode
16
- - rbx-19mode
17
12
  - ruby-head
18
- - jruby-head
19
13
  - 1.8.7
20
14
  - ree
21
15
  gemfile:
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 filesytem
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/test_minitest.rb
66
+ test/rails/test_active_support_spec_type.rb
67
+ test/test_sanity.rb
data/README.rdoc CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  MiniTest integration for Rails 3.x
4
4
 
5
+ {<img src="https://secure.travis-ci.org/blowmage/minitest-rails.png" alt="Build Status" />}[http://travis-ci.org/blowmage/minitest-rails]
6
+
5
7
  == Install
6
8
 
7
9
  gem install minitest-rails
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ Hoe.spec 'minitest-rails' do
19
19
  self.readme_file = "README.rdoc"
20
20
  self.testlib = :minitest
21
21
 
22
- dependency 'minitest', '~> 3.0'
22
+ dependency 'minitest', '~> 3.4'
23
23
  dependency 'rails', '~> 3.0'
24
24
  dependency 'fakefs', '~> 0.4', :dev
25
25
  end
@@ -0,0 +1,5 @@
1
+ Autotest.add_discovery do
2
+ style = []
3
+ style = ["minitest", "rails"] if File.exist? 'config/application.rb'
4
+ style
5
+ end
@@ -0,0 +1,7 @@
1
+ module Autotest::Fixtures
2
+ Autotest.add_hook :initialize do |at|
3
+ at.test_mappings['^test/fixtures/(.*)s.yml'] = proc { |filename, matches|
4
+ at.files_matching(/test\/\w+\/#{matches[1]}(_\w+)?.*_test.rb$/)
5
+ }
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module Autotest::Migrate
2
+ Autotest.add_hook(:run) do |autotest|
3
+ system "rake db:migrate" if autotest.class.to_s == "MinitestRails"
4
+ end
5
+ end
@@ -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
@@ -3,7 +3,7 @@ require "minitest/unit"
3
3
 
4
4
  module MiniTest
5
5
  module Rails
6
- VERSION = "0.1.3"
6
+ VERSION = "0.2"
7
7
  class Railtie < ::Rails::Railtie
8
8
  if ::Rails.version.to_f >= 3.1
9
9
  config.app_generators.integration_tool :mini_test
@@ -1,5 +1,7 @@
1
1
  require 'minitest/rails/active_support'
2
2
  require 'action_dispatch/testing/integration'
3
+ require 'action_controller/test_case'
4
+ require 'action_dispatch/routing/url_for'
3
5
 
4
6
  module MiniTest
5
7
  module Rails
@@ -10,6 +10,9 @@ module MiniTest
10
10
  # Register by name, because Helpers are just modules
11
11
  register_spec_type(/Helper( ?Test)?\z/i, self)
12
12
 
13
+ # View specs
14
+ register_spec_type(/View( ?Test)?\z/i, self)
15
+
13
16
  include ::ActionView::TestCase::Behavior
14
17
  end
15
18
  end
@@ -27,7 +27,7 @@ module MiniTest
27
27
  if defined?(ActiveRecord::Base)
28
28
  # Use AS::TestCase for the base class when describing a model
29
29
  register_spec_type(self) do |desc|
30
- desc < ActiveRecord::Base
30
+ desc < ActiveRecord::Base if desc.is_a?(Class)
31
31
  end
32
32
  end
33
33
 
@@ -73,3 +73,9 @@ namespace 'minitest' do
73
73
  end
74
74
 
75
75
  end
76
+
77
+ # Override the default task
78
+ task :default => [] # Just in case it hasn't already been set
79
+ Rake::Task[:default].clear
80
+ desc "Runs minitest"
81
+ task :default => "minitest"
@@ -2,41 +2,41 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "minitest-rails"
5
- s.version = "0.1.3.20120802091804"
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-08-02"
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/test_minitest.rb"]
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/test_minitest.rb"]
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.0"])
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.0"])
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.0"])
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
- assert_equal MiniTest::Spec.spec_type(ApplicationController), MiniTest::Rails::ActionController::TestCase
13
- assert_equal MiniTest::Spec.spec_type(ModelsController), MiniTest::Rails::ActionController::TestCase
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
- assert_equal MiniTest::Spec.spec_type("WidgetController"), MiniTest::Rails::ActionController::TestCase
18
- assert_equal MiniTest::Spec.spec_type("WidgetControllerTest"), MiniTest::Rails::ActionController::TestCase
19
- assert_equal MiniTest::Spec.spec_type("Widget Controller Test"), MiniTest::Rails::ActionController::TestCase
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
- assert_equal MiniTest::Spec.spec_type("widgetcontroller"), MiniTest::Rails::ActionController::TestCase
22
- assert_equal MiniTest::Spec.spec_type("widgetcontrollertest"), MiniTest::Rails::ActionController::TestCase
23
- assert_equal MiniTest::Spec.spec_type("widget controller test"), MiniTest::Rails::ActionController::TestCase
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
- refute_equal MiniTest::Spec.spec_type("Widget Controller\tTest"), MiniTest::Rails::ActionController::TestCase
28
- refute_equal MiniTest::Spec.spec_type("Widget Controller\rTest"), MiniTest::Rails::ActionController::TestCase
29
- refute_equal MiniTest::Spec.spec_type("Widget Controller\nTest"), MiniTest::Rails::ActionController::TestCase
30
- refute_equal MiniTest::Spec.spec_type("Widget Controller\fTest"), MiniTest::Rails::ActionController::TestCase
31
- refute_equal MiniTest::Spec.spec_type("Widget ControllerXTest"), MiniTest::Rails::ActionController::TestCase
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
- assert_equal MiniTest::Spec.spec_type("WidgetAcceptanceTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
9
- assert_equal MiniTest::Spec.spec_type("Widget Acceptance Test"), MiniTest::Rails::ActionDispatch::IntegrationTest
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
- assert_equal MiniTest::Spec.spec_type("widgetacceptancetest"), MiniTest::Rails::ActionDispatch::IntegrationTest
12
- assert_equal MiniTest::Spec.spec_type("widget acceptance test"), MiniTest::Rails::ActionDispatch::IntegrationTest
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
- refute_equal MiniTest::Spec.spec_type("Widget Acceptance\tTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
17
- refute_equal MiniTest::Spec.spec_type("Widget Acceptance\rTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
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
- refute_equal MiniTest::Spec.spec_type("Widget Acceptance\nTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
20
- refute_equal MiniTest::Spec.spec_type("Widget Acceptance\fTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
21
- refute_equal MiniTest::Spec.spec_type("Widget AcceptanceXTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
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
- assert_equal MiniTest::Spec.spec_type("WidgetIntegrationTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
26
- assert_equal MiniTest::Spec.spec_type("Widget Integration Test"), MiniTest::Rails::ActionDispatch::IntegrationTest
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
- assert_equal MiniTest::Spec.spec_type("widgetintegrationtest"), MiniTest::Rails::ActionDispatch::IntegrationTest
29
- assert_equal MiniTest::Spec.spec_type("widget integration test"), MiniTest::Rails::ActionDispatch::IntegrationTest
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
- assert_equal MiniTest::Spec.spec_type(NotificationMailer), MiniTest::Rails::ActionMailer::TestCase
14
- assert_equal MiniTest::Spec.spec_type(Notifications), MiniTest::Rails::ActionMailer::TestCase
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
- assert_equal MiniTest::Spec.spec_type("WidgetMailer"), MiniTest::Rails::ActionMailer::TestCase
19
- assert_equal MiniTest::Spec.spec_type("WidgetMailerTest"), MiniTest::Rails::ActionMailer::TestCase
20
- assert_equal MiniTest::Spec.spec_type("Widget Mailer Test"), MiniTest::Rails::ActionMailer::TestCase
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
- assert_equal MiniTest::Spec.spec_type("widgetmailer"), MiniTest::Rails::ActionMailer::TestCase
23
- assert_equal MiniTest::Spec.spec_type("widgetmailertest"), MiniTest::Rails::ActionMailer::TestCase
24
- assert_equal MiniTest::Spec.spec_type("widget mailer test"), MiniTest::Rails::ActionMailer::TestCase
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
- refute_equal MiniTest::Spec.spec_type("Widget Mailer\tTest"), MiniTest::Rails::ActionMailer::TestCase
29
- refute_equal MiniTest::Spec.spec_type("Widget Mailer\rTest"), MiniTest::Rails::ActionMailer::TestCase
30
- refute_equal MiniTest::Spec.spec_type("Widget Mailer\nTest"), MiniTest::Rails::ActionMailer::TestCase
31
- refute_equal MiniTest::Spec.spec_type("Widget Mailer\fTest"), MiniTest::Rails::ActionMailer::TestCase
32
- refute_equal MiniTest::Spec.spec_type("Widget MailerXTest"), MiniTest::Rails::ActionMailer::TestCase
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 test_spec_type_resolves_for_matching_strings
8
- assert_equal MiniTest::Spec.spec_type("WidgetHelper"), MiniTest::Rails::ActionView::TestCase
9
- assert_equal MiniTest::Spec.spec_type("WidgetHelperTest"), MiniTest::Rails::ActionView::TestCase
10
- assert_equal MiniTest::Spec.spec_type("Widget Helper Test"), MiniTest::Rails::ActionView::TestCase
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
- assert_equal MiniTest::Spec.spec_type("widgethelper"), MiniTest::Rails::ActionView::TestCase
13
- assert_equal MiniTest::Spec.spec_type("widgethelpertest"), MiniTest::Rails::ActionView::TestCase
14
- assert_equal MiniTest::Spec.spec_type("widget helper test"), MiniTest::Rails::ActionView::TestCase
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
- refute_equal MiniTest::Spec.spec_type("Widget Helper\tTest"), MiniTest::Rails::ActionView::TestCase
19
- refute_equal MiniTest::Spec.spec_type("Widget Helper\rTest"), MiniTest::Rails::ActionView::TestCase
20
- refute_equal MiniTest::Spec.spec_type("Widget Helper\nTest"), MiniTest::Rails::ActionView::TestCase
21
- refute_equal MiniTest::Spec.spec_type("Widget Helper\fTest"), MiniTest::Rails::ActionView::TestCase
22
- refute_equal MiniTest::Spec.spec_type("Widget HelperXTest"), MiniTest::Rails::ActionView::TestCase
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.1.3
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-08-02 00:00:00.000000000 Z
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.0'
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.0'
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/test_minitest.rb
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/test_minitest.rb
210
+ - test/rails/test_active_support_spec_type.rb
211
+ - test/test_sanity.rb