Sha256: 949a3d0163ea9509a5608d04f61fc4853e0bcd2ba7de6a368f3e9d1bba981124

Contents?: true

Size: 1.42 KB

Versions: 16

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 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

  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

16 entries across 16 versions & 1 rubygems

Version Path
minitest-spec-rails-4.7.3 test/cases/action_controller_test.rb
minitest-spec-rails-3.1.2 test/cases/action_controller_test.rb
minitest-spec-rails-4.7.2 test/cases/action_controller_test.rb
minitest-spec-rails-4.7.1 test/cases/action_controller_test.rb
minitest-spec-rails-3.1.1 test/cases/action_controller_test.rb
minitest-spec-rails-3.1.0 test/cases/action_controller_test.rb
minitest-spec-rails-4.7.0 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.8 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.7 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.6 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.5 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.4 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.3 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.2 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.1 test/cases/action_controller_test.rb
minitest-spec-rails-4.3.0 test/cases/action_controller_test.rb