News for hackers. Stuff that matters.
Re:Relative Line Numbers in Vim by Hovertruck on Monday June 03, 2013 @07:22AM (#5812560)
"Most testing libraries allow you to run a subset of tests based on their line number by running something like rspec spec/models/user_spec.rb:15."

This sounds... strange to me. When would this be an advantage over some sort of named test? e.g. `manage.py test Thing.validation_test`

Re:Relative Line Numbers in Vim by beaumartinez on Monday June 03, 2013 @07:38AM (#5812604)
> When would this be an advantage over some sort of named test?

Never. "Line number" is very obscure and prone to breaking. "I just added a comment at the top of the file... Whoops! Broke all the tests."

To quote the Zen Of Python—"explicit is better than implicit".

The article is a bit old so I wonder if that is still a common Ruby practice (if it ever was).

Re:Relative Line Numbers in Vim by jlogsdon on Monday June 03, 2013 @08:36AM (#5812842)
Rspec tests aren't simply named "Thing.validation_test", they are generally full sentence descriptions of what the functionality is (eg. "A User that belongs to a valid and paid account should allow creation of projects").

The only time I've ever run specific tests by line-number is when I am working on making that single test green. In cases like that the line-number hardly ever changes (if it does, its because I've modified before filters or added a new `let`).

edit: for a bit more context: that entire string would not be typed in for the single test, it would be built from contexts.

    describe User do
      context "belongs to a valid and paid account" do
        it "should allow creation of projects" do
        end
      end
    end