Sha256: b69376bdc1c43197c737d00ad8422d637e172b7c0cd3b22909f858d8f349f85d

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 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 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

6 entries across 6 versions & 1 rubygems

Version Path
minitest-spec-rails-4.7.11 test/cases/active_support_test.rb
minitest-spec-rails-4.7.10 test/cases/active_support_test.rb
minitest-spec-rails-4.7.9 test/cases/active_support_test.rb
minitest-spec-rails-4.7.8 test/cases/active_support_test.rb
minitest-spec-rails-4.7.7 test/cases/active_support_test.rb
minitest-spec-rails-4.7.6 test/cases/active_support_test.rb