diff options
author | Mike Moore <mike@blowmage.com> | 2012-09-24 15:48:12 -0600 |
---|---|---|
committer | Mike Moore <mike@blowmage.com> | 2012-09-24 15:49:40 -0600 |
commit | 64f254ccf74242453421d0c495388293dbc06c71 (patch) | |
tree | ea8ebf05a9719c699c2e34bc1ac1767a64d9d94f /actionpack | |
parent | c0a24555f9e2749fb94efe1967cb9943db0b6a7e (diff) | |
download | rails-64f254ccf74242453421d0c495388293dbc06c71.tar.gz rails-64f254ccf74242453421d0c495388293dbc06c71.tar.bz2 rails-64f254ccf74242453421d0c495388293dbc06c71.zip |
Register AD::IntegrationTest for minitest's spec DSL
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/integration.rb | 3 | ||||
-rw-r--r-- | actionpack/test/dispatch/spec_type_test.rb | 41 |
2 files changed, 44 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index a8b27ffafd..4bd7b69642 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -490,6 +490,9 @@ module ActionDispatch include ActionController::TemplateAssertions include ActionDispatch::Routing::UrlFor + # Use AD::IntegrationTest for acceptance tests + register_spec_type(/(Acceptance|Integration) ?Test\z/i, self) + @@app = nil def self.app diff --git a/actionpack/test/dispatch/spec_type_test.rb b/actionpack/test/dispatch/spec_type_test.rb new file mode 100644 index 0000000000..6cd19fd333 --- /dev/null +++ b/actionpack/test/dispatch/spec_type_test.rb @@ -0,0 +1,41 @@ +require "abstract_unit" + +class SpecTypeTest < ActiveSupport::TestCase + def assert_dispatch actual + assert_equal ActionDispatch::IntegrationTest, actual + end + + def refute_dispatch actual + refute_equal ActionDispatch::IntegrationTest, actual + end + + def test_spec_type_resolves_for_matching_acceptance_strings + assert_dispatch MiniTest::Spec.spec_type("WidgetAcceptanceTest") + assert_dispatch MiniTest::Spec.spec_type("Widget Acceptance Test") + assert_dispatch MiniTest::Spec.spec_type("widgetacceptancetest") + assert_dispatch MiniTest::Spec.spec_type("widget acceptance test") + end + + def test_spec_type_wont_match_non_space_characters_acceptance + refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\tTest") + refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\rTest") + refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\nTest") + refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\fTest") + refute_dispatch MiniTest::Spec.spec_type("Widget AcceptanceXTest") + end + + def test_spec_type_resolves_for_matching_integration_strings + assert_dispatch MiniTest::Spec.spec_type("WidgetIntegrationTest") + assert_dispatch MiniTest::Spec.spec_type("Widget Integration Test") + assert_dispatch MiniTest::Spec.spec_type("widgetintegrationtest") + assert_dispatch MiniTest::Spec.spec_type("widget integration test") + end + + def test_spec_type_wont_match_non_space_characters_integration + refute_dispatch MiniTest::Spec.spec_type("Widget Integration\tTest") + refute_dispatch MiniTest::Spec.spec_type("Widget Integration\rTest") + refute_dispatch MiniTest::Spec.spec_type("Widget Integration\nTest") + refute_dispatch MiniTest::Spec.spec_type("Widget Integration\fTest") + refute_dispatch MiniTest::Spec.spec_type("Widget IntegrationXTest") + end +end |