Sha256: 22f0f28985330041f85d72f25c8dcaacc61ee589e7e991c7fe6331fa058d9910

Contents?: true

Size: 1.93 KB

Versions: 9

Compression:

Stored size: 1.93 KB

Contents

require 'test_helper'

class ModelsController < ApplicationController;  end

class ActionControllerTest < MiniTestSpecRails::TestCase
  it 'resolves spec type for matching acceptance strings' do
    assert_dispatch MiniTest::Spec.spec_type('WidgetAcceptanceTest')
    assert_dispatch MiniTest::Spec.spec_type('Widget Acceptance Test')
    # And is case sensitive
    refute_dispatch MiniTest::Spec.spec_type('widgetacceptancetest')
    refute_dispatch MiniTest::Spec.spec_type('widget acceptance test')
  end

  it 'wont match spec type for space characters in acceptance strings' do
    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

  it 'resolves spec type for matching integration strings' do
    assert_dispatch MiniTest::Spec.spec_type('WidgetIntegrationTest')
    assert_dispatch MiniTest::Spec.spec_type('Widget Integration Test')
    # And is case sensitive
    refute_dispatch MiniTest::Spec.spec_type('widgetintegrationtest')
    refute_dispatch MiniTest::Spec.spec_type('widget integration test')
  end

  it 'wont match spec type for space characters in integration strings' do
    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

  private

  def assert_dispatch(actual)
    assert_equal ActionDispatch::IntegrationTest, actual
  end

  def refute_dispatch(actual)
    refute_equal ActionDispatch::IntegrationTest, actual
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
minitest-spec-rails-7.0.0 test/cases/action_dispatch_test.rb
minitest-spec-rails-6.2.0 test/cases/action_dispatch_test.rb
minitest-spec-rails-6.1.0 test/cases/action_dispatch_test.rb
minitest-spec-rails-6.0.4 test/cases/action_dispatch_test.rb
minitest-spec-rails-6.0.3 test/cases/action_dispatch_test.rb
minitest-spec-rails-6.0.2 test/cases/action_dispatch_test.rb
minitest-spec-rails-6.0.1 test/cases/action_dispatch_test.rb
minitest-spec-rails-6.0.0 test/cases/action_dispatch_test.rb
minitest-spec-rails-5.5.0 test/cases/action_dispatch_test.rb