Break out testing library from ActiveSupport?

77 views
Skip to first unread message

Brian Morton

unread,
Jan 9, 2014, 2:19:18 PM1/9/14
to rubyonra...@googlegroups.com
I followed down the path of why my app was bringing in 'minitest' in production and noticed that activesupport has a dependency on minitest.  I wondered why it wasn't a development dependency and then it dawned on me that it was necessary for ActiveSupport::TestCase.

What does the core team think about breaking the testing-related stuff out of activesupport into a separate gem?  It would eliminate the dependency on minitest and could load (probably a trival amount) of less code for production Rails apps.  Is this a good idea and a worthwhile thing for me to spend some time on?  Is this much more work than I think it might be?

Thanks in advance!
Brian

Rafael Mendonça França

unread,
Jan 9, 2014, 2:48:44 PM1/9/14
to rubyonra...@googlegroups.com
Hi Brian,

I think to we start to consider doing this we will need a stronger reason than load less code for production Rails apps. AFAIK, we don't require active_support/test_case in production environment so we are not loading minitest at production too.

If that is the case we should fix this, but I don't think we need to extract a new library.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.

Steve Klabnik

unread,
Jan 9, 2014, 4:08:34 PM1/9/14
to rubyonra...@googlegroups.com
Minitest is already in the standard library, so you're not really
adding or removing any meaningful dependence.

Jaco Pretorius

unread,
Jul 25, 2017, 8:12:19 PM7/25/17
to Ruby on Rails: Core, st...@steveklabnik.com
I just found this thread after noticing the same dependency today and looking for a way to potentially remove this. I don't quite see a dependency on minitest in the 'standard library' (by which I assume you mean the Rails gem itself).  https://github.com/rails/rails/blob/master/rails.gemspec  Or is there another dependency I'm missing?

As far as I can tell we would need to not autoload test_case.rb and then wrap the 'require' call to give a more meaningful error.  It's not clear to me if we expect consumers of the gem to use the ActiveSupport::TestCase class, or is that purely for testing the library itself?  I don't see any explicit examples for it in the documentation, but I'm also not that familiar with MiniTest.

Matt Jones

unread,
Aug 2, 2017, 2:50:11 PM8/2/17
to rubyonra...@googlegroups.com
On Jul 25, 2017, at 4:00 PM, Jaco Pretorius <jdjpre...@gmail.com> wrote:

On Thursday, January 9, 2014 at 4:08:34 PM UTC-5, Steve Klabnik wrote:
Minitest is already in the standard library, so you're not really 
adding or removing any meaningful dependence. 

I just found this thread after noticing the same dependency today and looking for a way to potentially remove this. I don't quite see a dependency on minitest in the 'standard library' (by which I assume you mean the Rails gem itself).  https://github.com/rails/rails/blob/master/rails.gemspec  Or is there another dependency I'm missing?


When Steve wrote that sentence three+ years ago, minitest was still included as part of the Ruby standard library. It was removed in 2.2 - see this discussion for more details:


As far as I can tell we would need to not autoload test_case.rb and then wrap the 'require' call to give a more meaningful error.  It's not clear to me if we expect consumers of the gem to use the ActiveSupport::TestCase class, or is that purely for testing the library itself?  I don't see any explicit examples for it in the documentation, but I'm also not that familiar with MiniTest.

ActiveSupport::TestCase can be used directly (see the example in the guides: http://guides.rubyonrails.org/testing.html#rails-meets-minitest ). The minitest plumbing is also used by Rspec (in at least some cases):


I’ll reiterate Rafael’s point from earlier in the thread: why is removing this dependency important?

—Matt Jones
Reply all
Reply to author
Forward
0 new messages