Sha256: b3a19054052240104e9da22fb70eafb9ad73f272eb1c440b86a08c7b0dbcfa6a

Contents?: true

Size: 1.4 KB

Versions: 14

Compression:

Stored size: 1.4 KB

Contents

require 'test_helper'

class SomeRandomModel < ActiveRecord::Base; end

class ActiveSupportTest < MiniTestSpecRails::TestCase

  it 'resolves spec type for active record constants' do
    assert_support MiniTest::Spec.spec_type(SomeRandomModel)
    assert_support MiniTest::Spec.spec_type(User)
  end

  it 'wont resolve spec type for random strings' do
    assert_spec MiniTest::Spec.spec_type("Unmatched String")
  end

  private

  def assert_support(actual)
    assert_equal ActiveSupport::TestCase, actual
  end

  def assert_spec(actual)
    assert_equal MiniTest::Spec, actual
  end

end

class ActiveSupportCallbackTest < ActiveSupport::TestCase
 
  setup :foo
  setup :bar
 
  it 'works' do
    @foo.must_equal 'foo'
    @bar.must_equal 'bar'
  end
 
  private
 
  def foo ; @foo = 'foo' ; end
  def bar ; @bar = 'bar' ; end
 
end

class ActiveSupportSpecTest < ActiveSupport::TestCase

  it 'current spec name' do
    Thread.current[:current_spec].must_equal self
  end

end

class ActiveSupportDescribeNamesTest < ActiveSupport::TestCase
  it 'class name' do
    assert_equal 'ActiveSupportDescribeNamesTest', self.class.name
  end
  describe 'level1' do
    it 'haz name' do
      assert_equal 'ActiveSupportDescribeNamesTest::level1', self.class.name
    end
    describe 'level2' do
      it 'haz name' do
        assert_equal 'ActiveSupportDescribeNamesTest::level1::level2', self.class.name
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
minitest-spec-rails-5.4.0 test/cases/active_support_test.rb
minitest-spec-rails-5.3.0 test/cases/active_support_test.rb
minitest-spec-rails-5.2.2 test/cases/active_support_test.rb
minitest-spec-rails-5.2.0 test/cases/active_support_test.rb
minitest-spec-rails-5.1.1 test/cases/active_support_test.rb
minitest-spec-rails-5.1.0 test/cases/active_support_test.rb
minitest-spec-rails-orangejulius-5.0.5.pre.orangejulius test/cases/active_support_test.rb
minitest-spec-rails-orangejulius-5.0.4.pre.orangejulius test/cases/active_support_test.rb
minitest-spec-rails-5.0.4 test/cases/active_support_test.rb
minitest-spec-rails-orangejulius-5.0.3.pre.orangejulius test/cases/active_support_test.rb
minitest-spec-rails-5.0.3 test/cases/active_support_test.rb
minitest-spec-rails-5.0.2 test/cases/active_support_test.rb
minitest-spec-rails-5.0.1 test/cases/active_support_test.rb
minitest-spec-rails-5.0.0 test/cases/active_support_test.rb