Sha256: be6be6e18f668454e551fadfd06c66fd93431b94989024decb8d3a2970e6c057

Contents?: true

Size: 1.42 KB

Versions: 22

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

22 entries across 22 versions & 2 rubygems

Version Path
minitest-spec-rails-4.7.11 test/cases/action_controller_test.rb
minitest-spec-rails-5.4.0 test/cases/action_controller_test.rb
minitest-spec-rails-4.7.10 test/cases/action_controller_test.rb
minitest-spec-rails-4.7.9 test/cases/action_controller_test.rb
minitest-spec-rails-5.3.0 test/cases/action_controller_test.rb
minitest-spec-rails-5.2.2 test/cases/action_controller_test.rb
minitest-spec-rails-4.7.8 test/cases/action_controller_test.rb
minitest-spec-rails-5.2.0 test/cases/action_controller_test.rb
minitest-spec-rails-5.1.1 test/cases/action_controller_test.rb
minitest-spec-rails-5.1.0 test/cases/action_controller_test.rb
minitest-spec-rails-orangejulius-5.0.5.pre.orangejulius test/cases/action_controller_test.rb
minitest-spec-rails-orangejulius-5.0.4.pre.orangejulius test/cases/action_controller_test.rb
minitest-spec-rails-4.7.7 test/cases/action_controller_test.rb
minitest-spec-rails-5.0.4 test/cases/action_controller_test.rb
minitest-spec-rails-orangejulius-5.0.3.pre.orangejulius test/cases/action_controller_test.rb
minitest-spec-rails-5.0.3 test/cases/action_controller_test.rb
minitest-spec-rails-5.0.2 test/cases/action_controller_test.rb
minitest-spec-rails-5.0.1 test/cases/action_controller_test.rb
minitest-spec-rails-4.7.6 test/cases/action_controller_test.rb
minitest-spec-rails-5.0.0 test/cases/action_controller_test.rb