:.Rake on tests is broken in Rails 5 #471

Closed
Xenofex opened this Issue Oct 10, 2016 · 12 comments

Projects

None yet

3 participants

@Xenofex
Xenofex commented Oct 10, 2016

Hello,

The :.Rake on test is broken in Rails 5. For in Rails 5, invoking a single test file is like

# Rails 5
$ rake test TEST=test/models/card_test.rb

or

# Rails 5
$ rails test test/models/card_test.rb

Before, it was like

$ rake test:unit TESTOPTS="..."

as it is written in your current implementation.

@tpope
Owner
tpope commented Oct 15, 2016

Wait, so what is it doing for you now? test:units?

@Xenofex
Xenofex commented Oct 15, 2016

rake test:units is gone, no more. rake test TEST=/path/to/test.rb is all rake test supports (besides rake test to run all tests), only file, no path.

Basically rake test is the only command that rake can execute. They made rails <cmd> delegates to rake <cmd>, but this is not true - they actually migrated to rails, abandoning rake in the mean time.

At least true for rake test - the recommended way to runt tests in Rails 5 is

$ rails test <file_or_folder_name>

Though it appears that from the updates of the issue that I created, they reconsidered having some backward compatibility.

For now, I think it's good to make rails test /path/to/test.rb[:line_no] to run a single test in Rails 5.

@tpope
Owner
tpope commented Oct 15, 2016

I'm asking you to clarify what the current behavior is, not what the
desired behavior is. I already addressed this issue once.

On Sat, Oct 15, 2016 at 8:27 AM Eli Wang notifications@github.com wrote:

rake test:units is gone, no more. rake test TEST=/path/to/test.rb is all rake
test supports (besides rake test to run all tests), only file, no path.

Basically rake test is the only command that rake can execute. They made rails
delegates to rake , but this is not true - they actually
migrated to rails, abandoning rake in the mean time.

At least true for rake test - the recommended way to runt tests in Rails
5 is

$ rails test <file_or_folder_name>

Though it appears that from the updates of the issue that I created
rails/rails#26748, they reconsidered having
some backward compatibility.

For now, I think it's good to make rails test /path/to/test.rb[:line_no]
to run a single test in Rails 5.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#471 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAABemhOAWkxukp4RO2yGVsTa_k5MbJnks5q0MabgaJpZM4KSZgq
.

@Xenofex
Xenofex commented Oct 15, 2016 edited

rake test:units throws an error in Rails 5: no such command.

BTW I read the code there. You did try a different path for Rails 5.

@Xenofex
Xenofex commented Oct 15, 2016

Yes I found the part that you mentioned above: detecting Rails 5 and run rake test "/path/to/file" for rails 5. Though this is not working. Because what you should run is rails test "path/to/file", not the rake one.

@tpope tpope added a commit that closed this issue Oct 15, 2016
@tpope Fix :Rake test run with Rails 5
Closes #471
09ffc84
@tpope tpope closed this in 09ffc84 Oct 15, 2016
@tpope
Owner
tpope commented Oct 15, 2016

For now, :Rake calls rake, and :Rails calls rails. I might get rid of :Rake entirely one day, I'm not sure.

@Xenofex
Xenofex commented Oct 15, 2016

Cool, thanks @tpope, for the tip and fix!

@caplod
caplod commented Feb 11, 2017

I have a brand new rails 5 app and when I call :.Rake inside a test file it gives me:

Don't know how to build task 'test/models/film_test.rb:4' (see --tasks)
bin/rake test test/models/film_test.rb:4 

shouldn`t that be ?

bin/rake test TEST=test/models/film_test.rb:4

I have the latest vim-rails

@tpope
Owner
tpope commented Feb 13, 2017

It should be either what you say, or bin/rails test test/models/film_test.rb:4. The hybrid is wrong.

@tpope
Owner
tpope commented Feb 13, 2017

And to be clear, the fix I pushed should make :.Rake do bin/rake test TEST=test/models/film_test.rb:4, so make sure you are up to date.

@caplod
caplod commented Feb 15, 2017

I had vim configured with the janus distribution.
Unfortunately it wasnt mentioned that vim-rails is already included (in a older version).
So vim was using the old version instead of the newer one.
Disabled the old version, now everything is working!!
Sorry for bothering you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment