aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/spec_type_test.rb
blob: 6cd19fd333dda6257fe8aa05cd151f395c2f3399 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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