Sha256: 46831dee850ed055bb36050ad985d822c36f4282637a8bbd38e820d82812e0bd

Contents?: true

Size: 1.34 KB

Versions: 22

Compression:

Stored size: 1.34 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 case sensitive
    refute_mailer MiniTest::Spec.spec_type("widgetmailer")
    refute_mailer MiniTest::Spec.spec_type("widgetmailertest")
    refute_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

22 entries across 22 versions & 2 rubygems

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