Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: blowmage/minitest-rails
base: v0.1.1
...
head fork: blowmage/minitest-rails
compare: v0.1.2
Checking mergeability… Don't worry, you can still create the pull request.
  • 11 commits
  • 24 files changed
  • 0 commit comments
  • 4 contributors
Commits on Jul 24, 2012
@blowmage Add support for Travis CI f735c2d
@haihappen haihappen Code cleanup. 519f83e
@haihappen haihappen Allow strings as spec types too. 74b70b7
@haihappen haihappen Merged regexps. 81ffb75
@haihappen haihappen Revert "Code cleanup."
This reverts commit 519f83e.

Conflicts:
	lib/minitest/rails/action_controller.rb
	lib/minitest/rails/action_dispatch.rb
	lib/minitest/rails/action_mailer.rb
	lib/minitest/rails/action_view.rb
924503a
@blowmage Merge pull request #62 from haihappen/master
Register strings for spec types

Allow spec type lookup to work on string descriptions as well as class constants.

Thank you for your contribution!
5588f94
Commits on Jul 25, 2012
@blowmage Remove case sensitivity on spec type strings b40c6b2
@blowmage Move test locations 9679420
@blowmage Update spec regex to be a bit stricter
We don't want to match new lines in the spec string.
682e5c7
Commits on Jul 26, 2012
@terrcin terrcin Add check for ActionMailer (closes #66)
Check that ActionMailer is loaded before using the code for it.
a8ea722
Commits on Jul 27, 2012
@blowmage Version bump for 0.1.2 release d589ae2
View
26 .travis.yml
@@ -0,0 +1,26 @@
+---
+after_script:
+- rake travis:after -t
+before_script:
+- gem install hoe-travis --no-rdoc --no-ri
+- rake travis:before -t
+language: ruby
+notifications:
+ email:
+ - mike@blowmage.com
+rvm:
+- 1.9.3
+- 1.9.2
+- jruby-18mode
+- jruby-19mode
+- rbx-18mode
+- rbx-19mode
+- ruby-head
+- jruby-head
+- 1.8.7
+- ree
+gemfile:
+- gemfiles/3.0.gemfile
+- gemfiles/3.1.gemfile
+- gemfiles/3.2.gemfile
+script: rake travis
View
7 CHANGELOG.rdoc
@@ -1,3 +1,10 @@
+=== 0.1.2 / 2012-07-26
+
+* Fix bug when ActionMailer isn't loaded (closes #66)
+* Allow specs to use strings in `describe` blocks
+
+https://github.com/blowmage/minitest-rails/compare/v0.1.1...v0.1.2
+
=== 0.1.1 / 2012-07-17
* Improved rake tasks
View
20 Manifest.txt
@@ -1,10 +1,14 @@
.autotest
.gemtest
+.travis.yml
CHANGELOG.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile
+gemfiles/3.0.gemfile
+gemfiles/3.1.gemfile
+gemfiles/3.2.gemfile
lib/generators/mini_test.rb
lib/generators/mini_test/controller/controller_generator.rb
lib/generators/mini_test/controller/templates/controller_spec.rb
@@ -39,10 +43,14 @@ lib/minitest/rails/mochaing.rb
lib/minitest/rails/tasks/minitest.rake
lib/minitest/rails/tasks/sub_test_task.rb
minitest-rails.gemspec
-test/test_controller_generator.rb
-test/test_helper_generator.rb
-test/test_install_generator.rb
-test/test_mailer_generator.rb
+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/test_action_controller_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
-test/test_model_generator.rb
-test/test_scaffold_generator.rb
View
1  Rakefile
@@ -5,6 +5,7 @@ require 'hoe'
Hoe.plugin :git
Hoe.plugin :gemspec
+Hoe.plugin :travis
Hoe.plugins.delete :rubyforge
Hoe.spec 'minitest-rails' do
View
8 gemfiles/3.0.gemfile
@@ -0,0 +1,8 @@
+source "http://rubygems.org"
+
+gem "rails", "~> 3.0.15"
+gem "minitest", "~> 3.0"
+gem "rdoc", "~> 3.10"
+gem "hoe", "~> 3.0"
+
+gemspec :path=>"../"
View
8 gemfiles/3.1.gemfile
@@ -0,0 +1,8 @@
+source "http://rubygems.org"
+
+gem "rails", "~> 3.1.6"
+gem "minitest", "~> 3.0"
+gem "rdoc", "~> 3.10"
+gem "hoe", "~> 3.0"
+
+gemspec :path=>"../"
View
8 gemfiles/3.2.gemfile
@@ -0,0 +1,8 @@
+source "http://rubygems.org"
+
+gem "rails", "~> 3.2.6"
+gem "minitest", "~> 3.0"
+gem "rdoc", "~> 3.10"
+gem "hoe", "~> 3.0"
+
+gemspec :path=>"../"
View
2  lib/minitest-rails.rb
@@ -3,7 +3,7 @@
module MiniTest
module Rails
- VERSION = "0.1.1"
+ VERSION = "0.1.2"
class Railtie < ::Rails::Railtie
if ::Rails.version.to_f >= 3.1
config.app_generators.integration_tool :mini_test
View
4 lib/minitest/rails.rb
@@ -5,7 +5,7 @@
require "minitest/rails/active_support"
require "minitest/rails/action_controller"
require "minitest/rails/action_view"
-require "minitest/rails/action_mailer"
+require "minitest/rails/action_mailer" if defined? ActionMailer
require "minitest/rails/action_dispatch"
# Enable turn if it is available
@@ -21,7 +21,7 @@ def self.override_testunit!
::ActiveSupport.const_set :TestCase, MiniTest::Rails::ActiveSupport::TestCase
::ActionController.const_set :TestCase, MiniTest::Rails::ActionController::TestCase
::ActionView.const_set :TestCase, MiniTest::Rails::ActionView::TestCase
- ::ActionMailer.const_set :TestCase, MiniTest::Rails::ActionMailer::TestCase
+ ::ActionMailer.const_set :TestCase, MiniTest::Rails::ActionMailer::TestCase if defined? ActionMailer
::ActionDispatch.const_set :IntegrationTest, MiniTest::Rails::ActionDispatch::IntegrationTest
end
end
View
3  lib/minitest/rails/action_controller.rb
@@ -9,8 +9,9 @@ class TestCase < MiniTest::Rails::ActiveSupport::TestCase
# Use AC::TestCase for the base class when describing a controller
register_spec_type(self) do |desc|
- desc < ::ActionController::Base
+ desc < ::ActionController::Base if desc.is_a?(Class)
end
+ register_spec_type(/Controller( ?Test)?\z/i, self)
include ::ActionController::TestCase::Behavior
end
View
10 lib/minitest/rails/action_dispatch.rb
@@ -24,13 +24,11 @@ def self.app=(app)
def app
super || ::ActionDispatch::IntegrationTest.app
end
+
+ # Register by name
+ register_spec_type(/Acceptance ?Test\z/i, self)
+ register_spec_type(/Integration ?Test\z/i, self)
end
end
end
end
-
-# Register by name
-MiniTest::Spec.register_spec_type(/AcceptanceTest$/, MiniTest::Rails::ActionDispatch::IntegrationTest)
-MiniTest::Spec.register_spec_type(/Acceptance Test$/, MiniTest::Rails::ActionDispatch::IntegrationTest)
-MiniTest::Spec.register_spec_type(/IntegrationTest$/, MiniTest::Rails::ActionDispatch::IntegrationTest)
-MiniTest::Spec.register_spec_type(/Integration Test$/, MiniTest::Rails::ActionDispatch::IntegrationTest)
View
4 lib/minitest/rails/action_mailer.rb
@@ -7,9 +7,11 @@ module ActionMailer
class TestCase < MiniTest::Rails::ActiveSupport::TestCase
# Use AM::TestCase for the base class when describing a mailer
register_spec_type(self) do |desc|
- desc < ::ActionMailer::Base
+ desc < ::ActionMailer::Base if desc.is_a?(Class)
end
+ register_spec_type(/Mailer( ?Test)?\z/i, self)
+
include ::ActionMailer::TestCase::Behavior
end
end
View
9 lib/minitest/rails/action_view.rb
@@ -6,13 +6,12 @@ module Rails
module ActionView
class TestCase < MiniTest::Rails::ActiveSupport::TestCase
TestController = ::ActionView::TestCase::TestController
+
+ # Register by name, because Helpers are just modules
+ register_spec_type(/Helper( ?Test)?\z/i, self)
+
include ::ActionView::TestCase::Behavior
end
end
end
end
-
-# Register by name, because Helpers are just modules
-MiniTest::Spec.register_spec_type(/Helper$/, MiniTest::Rails::ActionView::TestCase)
-MiniTest::Spec.register_spec_type(/HelperTest$/, MiniTest::Rails::ActionView::TestCase)
-MiniTest::Spec.register_spec_type(/Helper Test$/, MiniTest::Rails::ActionView::TestCase)
View
8 minitest-rails.gemspec
@@ -2,22 +2,22 @@
Gem::Specification.new do |s|
s.name = "minitest-rails"
- s.version = "0.1.1.20120717012609"
+ s.version = "0.1.2.20120726190745"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Mike Moore"]
- s.date = "2012-07-17"
+ s.date = "2012-07-27"
s.description = "Adds MiniTest as the default testing library in Rails 3.x"
s.email = ["mike@blowmage.com"]
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
- s.files = [".autotest", ".gemtest", "CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "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/test_controller_generator.rb", "test/test_helper_generator.rb", "test/test_install_generator.rb", "test/test_mailer_generator.rb", "test/test_minitest.rb", "test/test_model_generator.rb", "test/test_scaffold_generator.rb"]
+ s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/3.0.gemfile", "gemfiles/3.1.gemfile", "gemfiles/3.2.gemfile", "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/test_action_controller_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"]
s.homepage = "http://blowmage.com/minitest-rails"
s.rdoc_options = ["--main", "README.rdoc"]
s.require_paths = ["lib"]
s.rubyforge_project = "minitest-rails"
s.rubygems_version = "1.8.24"
s.summary = "MiniTest integration for Rails 3.x"
- s.test_files = ["test/test_controller_generator.rb", "test/test_helper_generator.rb", "test/test_install_generator.rb", "test/test_mailer_generator.rb", "test/test_minitest.rb", "test/test_model_generator.rb", "test/test_scaffold_generator.rb"]
+ 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/test_action_controller_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"]
if s.respond_to? :specification_version then
s.specification_version = 3
View
0  test/test_controller_generator.rb → test/generators/test_controller_generator.rb
File renamed without changes
View
0  test/test_helper_generator.rb → test/generators/test_helper_generator.rb
File renamed without changes
View
0  test/test_install_generator.rb → test/generators/test_install_generator.rb
File renamed without changes
View
0  test/test_mailer_generator.rb → test/generators/test_mailer_generator.rb
File renamed without changes
View
0  test/test_model_generator.rb → test/generators/test_model_generator.rb
File renamed without changes
View
0  test/test_scaffold_generator.rb → test/generators/test_scaffold_generator.rb
File renamed without changes
View
33 test/rails/test_action_controller_spec_type.rb
@@ -0,0 +1,33 @@
+require "minitest/autorun"
+require "rails"
+
+require "minitest/rails/action_controller"
+require "action_controller"
+
+class ApplicationController < ActionController::Base; end
+class ModelsController < ApplicationController; end
+
+class TestApplicationControllerSpecType < MiniTest::Unit::TestCase
+ def test_spec_type_resolves_for_class_constants
+ assert_equal MiniTest::Spec.spec_type(ApplicationController), MiniTest::Rails::ActionController::TestCase
+ assert_equal MiniTest::Spec.spec_type(ModelsController), MiniTest::Rails::ActionController::TestCase
+ end
+
+ def test_spec_type_resolves_for_matching_strings
+ assert_equal MiniTest::Spec.spec_type("WidgetController"), MiniTest::Rails::ActionController::TestCase
+ assert_equal MiniTest::Spec.spec_type("WidgetControllerTest"), MiniTest::Rails::ActionController::TestCase
+ assert_equal MiniTest::Spec.spec_type("Widget Controller Test"), MiniTest::Rails::ActionController::TestCase
+ # And is not case sensitive
+ assert_equal MiniTest::Spec.spec_type("widgetcontroller"), MiniTest::Rails::ActionController::TestCase
+ assert_equal MiniTest::Spec.spec_type("widgetcontrollertest"), MiniTest::Rails::ActionController::TestCase
+ assert_equal MiniTest::Spec.spec_type("widget controller test"), MiniTest::Rails::ActionController::TestCase
+ end
+
+ def test_spec_type_wont_match_non_space_characters
+ refute_equal MiniTest::Spec.spec_type("Widget Controller\tTest"), MiniTest::Rails::ActionController::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Controller\rTest"), MiniTest::Rails::ActionController::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Controller\nTest"), MiniTest::Rails::ActionController::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Controller\fTest"), MiniTest::Rails::ActionController::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget ControllerXTest"), MiniTest::Rails::ActionController::TestCase
+ end
+end
View
40 test/rails/test_action_dispatch_spec_type.rb
@@ -0,0 +1,40 @@
+require "minitest/autorun"
+require "rails"
+
+require "minitest/rails/action_dispatch"
+
+class TestActionDispatchSpecType < MiniTest::Unit::TestCase
+ def test_spec_type_resolves_for_matching_acceptance_strings
+ assert_equal MiniTest::Spec.spec_type("WidgetAcceptanceTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ assert_equal MiniTest::Spec.spec_type("Widget Acceptance Test"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ # And is not case sensitive
+ assert_equal MiniTest::Spec.spec_type("widgetacceptancetest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ assert_equal MiniTest::Spec.spec_type("widget acceptance test"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ end
+
+ def test_spec_type_wont_match_non_space_characters_acceptance
+ refute_equal MiniTest::Spec.spec_type("Widget Acceptance\tTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ refute_equal MiniTest::Spec.spec_type("Widget Acceptance\rTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ # TODO: Update regex so that new lines don't match.
+ refute_equal MiniTest::Spec.spec_type("Widget Acceptance\nTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ refute_equal MiniTest::Spec.spec_type("Widget Acceptance\fTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ refute_equal MiniTest::Spec.spec_type("Widget AcceptanceXTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ end
+
+ def test_spec_type_resolves_for_matching_integration_strings
+ assert_equal MiniTest::Spec.spec_type("WidgetIntegrationTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ assert_equal MiniTest::Spec.spec_type("Widget Integration Test"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ # And is not case sensitive
+ assert_equal MiniTest::Spec.spec_type("widgetintegrationtest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ assert_equal MiniTest::Spec.spec_type("widget integration test"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ end
+
+ def test_spec_type_wont_match_non_space_characters_integration
+ refute_equal MiniTest::Spec.spec_type("Widget Integration\tTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ refute_equal MiniTest::Spec.spec_type("Widget Integration\rTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ # TODO: Update regex so that new lines don't match.
+ refute_equal MiniTest::Spec.spec_type("Widget Integration\nTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ refute_equal MiniTest::Spec.spec_type("Widget Integration\fTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ refute_equal MiniTest::Spec.spec_type("Widget IntegrationXTest"), MiniTest::Rails::ActionDispatch::IntegrationTest
+ end
+end
View
34 test/rails/test_action_mailer_spec_type.rb
@@ -0,0 +1,34 @@
+require "minitest/autorun"
+require "rails"
+
+require "action_mailer/test_helper"
+require "minitest/rails/action_mailer"
+require "action_mailer"
+
+class NotificationMailer < ActionMailer::Base; end
+class Notifications < ActionMailer::Base; end
+
+class TestActionMailerSpecType < MiniTest::Unit::TestCase
+ def test_spec_type_resolves_for_class_constants
+ assert_equal MiniTest::Spec.spec_type(NotificationMailer), MiniTest::Rails::ActionMailer::TestCase
+ assert_equal MiniTest::Spec.spec_type(Notifications), MiniTest::Rails::ActionMailer::TestCase
+ end
+
+ def test_spec_type_resolves_for_matching_strings
+ assert_equal MiniTest::Spec.spec_type("WidgetMailer"), MiniTest::Rails::ActionMailer::TestCase
+ assert_equal MiniTest::Spec.spec_type("WidgetMailerTest"), MiniTest::Rails::ActionMailer::TestCase
+ assert_equal MiniTest::Spec.spec_type("Widget Mailer Test"), MiniTest::Rails::ActionMailer::TestCase
+ # And is not case sensitive
+ assert_equal MiniTest::Spec.spec_type("widgetmailer"), MiniTest::Rails::ActionMailer::TestCase
+ assert_equal MiniTest::Spec.spec_type("widgetmailertest"), MiniTest::Rails::ActionMailer::TestCase
+ assert_equal MiniTest::Spec.spec_type("widget mailer test"), MiniTest::Rails::ActionMailer::TestCase
+ end
+
+ def test_spec_type_wont_match_non_space_characters
+ refute_equal MiniTest::Spec.spec_type("Widget Mailer\tTest"), MiniTest::Rails::ActionMailer::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Mailer\rTest"), MiniTest::Rails::ActionMailer::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Mailer\nTest"), MiniTest::Rails::ActionMailer::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Mailer\fTest"), MiniTest::Rails::ActionMailer::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget MailerXTest"), MiniTest::Rails::ActionMailer::TestCase
+ end
+end
View
24 test/rails/test_action_view_spec_type.rb
@@ -0,0 +1,24 @@
+require "minitest/autorun"
+require "rails"
+
+require "minitest/rails/action_view"
+
+class TestActionViewSpecType < MiniTest::Unit::TestCase
+ def test_spec_type_resolves_for_matching_strings
+ assert_equal MiniTest::Spec.spec_type("WidgetHelper"), MiniTest::Rails::ActionView::TestCase
+ assert_equal MiniTest::Spec.spec_type("WidgetHelperTest"), MiniTest::Rails::ActionView::TestCase
+ assert_equal MiniTest::Spec.spec_type("Widget Helper Test"), MiniTest::Rails::ActionView::TestCase
+ # And is not case sensitive
+ assert_equal MiniTest::Spec.spec_type("widgethelper"), MiniTest::Rails::ActionView::TestCase
+ assert_equal MiniTest::Spec.spec_type("widgethelpertest"), MiniTest::Rails::ActionView::TestCase
+ assert_equal MiniTest::Spec.spec_type("widget helper test"), MiniTest::Rails::ActionView::TestCase
+ end
+
+ def test_spec_type_wont_match_non_space_characters
+ refute_equal MiniTest::Spec.spec_type("Widget Helper\tTest"), MiniTest::Rails::ActionView::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Helper\rTest"), MiniTest::Rails::ActionView::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Helper\nTest"), MiniTest::Rails::ActionView::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget Helper\fTest"), MiniTest::Rails::ActionView::TestCase
+ refute_equal MiniTest::Spec.spec_type("Widget HelperXTest"), MiniTest::Rails::ActionView::TestCase
+ end
+end

No commit comments for this range

Something went wrong with that request. Please try again.