Sha256: 8688edb77e58f4874741c98f896031f1a21e2bc9c52b726af85d5ac3557481c0

Contents?: true

Size: 1.48 KB

Versions: 11

Compression:

Stored size: 1.48 KB

Contents

require "helper"

class ApplicationController < ActionController::Base; end
class ModelsController      < ApplicationController;  end

class TestApplicationControllerSpecType < MiniTest::Unit::TestCase
  def assert_controller actual
    assert_equal ActionController::TestCase, actual
  end

  def refute_controller actual
    refute_equal ActionController::TestCase, actual
  end

  def test_spec_type_resolves_for_class_constants
    assert_controller MiniTest::Spec.spec_type(ApplicationController)
    assert_controller MiniTest::Spec.spec_type(ModelsController)
  end

  def test_spec_type_resolves_for_matching_strings
    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 not case sensitive
    assert_controller MiniTest::Spec.spec_type("widgetcontroller")
    assert_controller MiniTest::Spec.spec_type("widgetcontrollertest")
    assert_controller MiniTest::Spec.spec_type("widget controller test")
  end

  def test_spec_type_wont_match_non_space_characters
    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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
minitest-rails-1.0.1 test/rails/action_controller/test_spec_type.rb
minitest-rails-1.0.0 test/rails/action_controller/test_spec_type.rb
minitest-rails-1.0.0.beta3 test/rails/action_controller/test_spec_type.rb
minitest-rails-1.0.0.beta2 test/rails/action_controller/test_spec_type.rb
minitest-rails-1.0.0.beta1 test/rails/action_controller/test_spec_type.rb
minitest-rails-0.9.2 test/rails/action_controller/test_spec_type.rb
minitest-rails-0.9.1 test/rails/action_controller/test_spec_type.rb
minitest-rails-0.9.0 test/rails/action_controller/test_spec_type.rb
minitest-rails-0.5.2 test/rails/action_controller/test_spec_type.rb
minitest-rails-0.5.1 test/rails/action_controller/test_spec_type.rb
minitest-rails-0.5 test/rails/action_controller/test_spec_type.rb