Sha256: 74e605882e0a1ef3e223ae51343f16aca11969bd11ab75c12d823b7047d17bea

Contents?: true

Size: 1.42 KB

Versions: 9

Compression:

Stored size: 1.42 KB

Contents

require 'test_helper'

class ModelsController < ApplicationController;  end

class ActionControllerTest < MiniTestSpecRails::TestCase
  it 'matches spec type for class constants' do
    assert_controller MiniTest::Spec.spec_type(ApplicationController)
    assert_controller MiniTest::Spec.spec_type(ModelsController)
  end

  it 'matches spec type for strings' do
    assert_controller MiniTest::Spec.spec_type('WidgetController')
    assert_controller MiniTest::Spec.spec_type('WidgetControllerTest')
    assert_controller MiniTest::Spec.spec_type('Widget Controller Test')
    # And is case sensitive
    refute_controller MiniTest::Spec.spec_type('widgetcontroller')
    refute_controller MiniTest::Spec.spec_type('widgetcontrollertest')
    refute_controller MiniTest::Spec.spec_type('widget controller test')
  end

  it 'wont match spec type for non space characters' do
    refute_controller MiniTest::Spec.spec_type("Widget Controller\tTest")
    refute_controller MiniTest::Spec.spec_type("Widget Controller\rTest")
    refute_controller MiniTest::Spec.spec_type("Widget Controller\nTest")
    refute_controller MiniTest::Spec.spec_type("Widget Controller\fTest")
    refute_controller MiniTest::Spec.spec_type('Widget ControllerXTest')
  end

  private

  def assert_controller(actual)
    assert_equal ActionController::TestCase, actual
  end

  def refute_controller(actual)
    refute_equal ActionController::TestCase, actual
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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