Sha256: ab8f1787c1a6d0d1f98e19691fa033235ec94a66973346ec66516626aaf1b604

Contents?: true

Size: 1.35 KB

Versions: 16

Compression:

Stored size: 1.35 KB

Contents

require 'test_helper'

class NotificationMailer < ActionMailer::Base; end
class Notifications < ActionMailer::Base; end

class ActionMailerTest < MiniTestSpecRails::TestCase

  it 'matches spec type for class constants' do
    assert_mailer MiniTest::Spec.spec_type(NotificationMailer)
    assert_mailer MiniTest::Spec.spec_type(Notifications)
  end

  it 'matches spec type for strings' do
    assert_mailer MiniTest::Spec.spec_type("WidgetMailer")
    assert_mailer MiniTest::Spec.spec_type("WidgetMailerTest")
    assert_mailer MiniTest::Spec.spec_type("Widget Mailer Test")
    # And is not case sensitive
    assert_mailer MiniTest::Spec.spec_type("widgetmailer")
    assert_mailer MiniTest::Spec.spec_type("widgetmailertest")
    assert_mailer MiniTest::Spec.spec_type("widget mailer test")
  end

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


  private

  def assert_mailer(actual)
    assert_equal ActionMailer::TestCase, actual
  end

  def refute_mailer(actual)
    refute_equal ActionMailer::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_mailer_test.rb
minitest-spec-rails-3.1.2 test/cases/action_mailer_test.rb
minitest-spec-rails-4.7.2 test/cases/action_mailer_test.rb
minitest-spec-rails-4.7.1 test/cases/action_mailer_test.rb
minitest-spec-rails-3.1.1 test/cases/action_mailer_test.rb
minitest-spec-rails-3.1.0 test/cases/action_mailer_test.rb
minitest-spec-rails-4.7.0 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.8 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.7 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.6 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.5 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.4 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.3 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.2 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.1 test/cases/action_mailer_test.rb
minitest-spec-rails-4.3.0 test/cases/action_mailer_test.rb