Skip to content

Commit

Permalink
Register non ActiveRecord::Base classes correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Lindqvist committed Mar 19, 2013
1 parent a759403 commit 6693c86
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/minitest-spec-rails/init/active_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module ActiveSupportBehavior
singleton_class.class_eval { remove_method :describe }
extend MiniTest::Spec::DSL
include MiniTestSpecRails::DSL
register_spec_type(self) { |desc| Class === desc && desc < ActiveRecord::Base if defined?(ActiveRecord::Base) }
register_spec_type(self) { |desc| Class === desc }
register_rails_test_case self
end

Expand Down
2 changes: 2 additions & 0 deletions test/dummy_app/lib/library.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Library
end
16 changes: 16 additions & 0 deletions test/dummy_tests/library_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'test_helper_dummy'
require_relative '../dummy_app/lib/library'

class LibraryTest < ActiveSupport::TestCase
it 'reflects' do
describing_class.must_equal LibraryTest
described_class.must_equal Library
end
end

describe Library do
it 'reflects' do
described_class.must_equal Library
self.class.described_class.must_equal Library
end
end

0 comments on commit 6693c86

Please sign in to comment.