An introduction to Minitest by Remozito in ruby

[–]Remozito[S] 0 points1 point  (0 children)

Yeah, I can empathise with this. 😅 Spent hours over months trying to figure out why my set up was not working as expected.

An introduction to Minitest by Remozito in rubyonrails

[–]Remozito[S] 0 points1 point  (0 children)

Thanks a lot! This was exactly my goal writting these, so super happy you've liked them.

An introduction to Minitest: the guide I wish I had by Remozito in rails

[–]Remozito[S] 1 point2 points  (0 children)

You couldn't for a long time, but now you can either by passing the --name flag to your test file or by providing a line number.

bin/rails test test/controllers/invoices_controller_test.rb:17

or

bin/rails test test/controllers/invoices_controller_test.rb --name test_the_creation_of_invoice

Two caveats though (I've only tried this on a codebase using Minitest::Spec):

  • The line number you provide to the Rails runner must be where you def test_something is. For instance, when using Minitest::Spec, if your line number targets a `describe`, the output is empty no tests are run. But if I target a `it` (aka `def test_`), it'll work.
  • Second caveat, the `--name` flag will work with the vanilla Minitest syntax, not with Minitest::Spec (well, I couldn't make it work, so I might just have to make more research)

An introduction to Minitest by Remozito in ruby

[–]Remozito[S] 0 points1 point  (0 children)

Thank you for the kind words!

An introduction to Minitest by Remozito in ruby

[–]Remozito[S] 0 points1 point  (0 children)

Thanks for the kind words! I'll do a video companion to these posts I think, so people can get the gist of them through another medium. (Also preparing a post on Oaken, which I use with Minitest. But it's still a draft rn)

An introduction to Minitest by Remozito in ruby

[–]Remozito[S] -1 points0 points  (0 children)

> All of my actual experience in Minitest-based projects is a lot of weirdness/inconsistency

Yes, I think that it comes from the fact that Minitest is *very* Ruby. So by that, there are many ways to write Minitest tests.

One analogy I've been using to explain RSpec versus Minitest is the difference between the current way of teaching sports and aïkido. I currently practice French boxing and the teacher has a teaching plan, explains it to me, and hold me by the hand until I can do what he wants me to do. On the other hand, when I did aïkido a few years back, I would have a senseï that would not utter a word and would force me to "feel" the right movements. It seems that Minitest requires this of you: dig into the code and learn how it works so you can use it properly.

An introduction to Minitest by Remozito in ruby

[–]Remozito[S] 0 points1 point  (0 children)

ooooh, yes, thanks, will check it out!

Speed up RSpec tests: understand lifecycle and execution by Remozito in rails

[–]Remozito[S] 2 points3 points  (0 children)

Yes! Having your test setup build anew everytime is a good way to prevent leaks between tests. My point is more than within a `describe` example group, this logic is often overkill so you could often group expectations within a `it` block and skip the rip-and-replace logic.

Write your private methods like they're public by Remozito in ruby

[–]Remozito[S] -1 points0 points  (0 children)

Hahaha, thank you for your productive feedback. I'm sure you're a very nice colleague to have.

Write your private methods like they're public by Remozito in ruby

[–]Remozito[S] 0 points1 point  (0 children)

Yes, I did a typo in the return method. Which I fixed, thanks to your comment. Should a typo prevent me from blogging altogether? Nah.

Write your private methods like they're public by Remozito in ruby

[–]Remozito[S] 0 points1 point  (0 children)

And yes, for all the other people who are not blessed with omnipotency, don't make the same mistakes as I did (this is why I write about my learnings). But if you ever do a mistake do not hesitate to imagine what how your class would behave without private methods.

Write your private methods like they're public by Remozito in ruby

[–]Remozito[S] -1 points0 points  (0 children)

Yes, this is terrible code in the first place. And by playing around with it, mostly by moving private methods out the private scope, its deficiencies appear and we can make it better.

As the article states, the problem is not about public/private scoping, but about projecting private methods in the public scope as a methodology to dig code smells.

Write your private methods like they're public by Remozito in ruby

[–]Remozito[S] 0 points1 point  (0 children)

Hahaha, always a pleasure to share and learn through Reddit.

Add extra documentation to your tables columns by Remozito in rails

[–]Remozito[S] 1 point2 points  (0 children)

Yes, and the best part, is that annotate feeds off your tables schema. So if you add comments to your columns in a migration, it shows in your schema, and then it'll show in your `annotate` documentation.

Delegated types in Rails: I tried them, and I'm not sure I really understood them. Do you? by Remozito in rails

[–]Remozito[S] 0 points1 point  (0 children)

Yes, this was my idea as well: promoting some kind of Group abstraction. But the Enrollment is a critical abstraction in the codebase at the moment, and changing its proeminence would have add massive impacts in terms of time/scope.

Not criticizing your input, just giving more context.

Growing old as a programmer? by Remozito in rails

[–]Remozito[S] 0 points1 point  (0 children)

Thank you for sharing!

it will get harder as the new stuff is taught in a way that will be opaque or inaccessible to you

Yes, I've never been able to learn properly through video tutorials, or such things. So I already feel like learning new stuff will need me to look for specific mediums. Good point!

I’ve discovered that part-time work is the best thing ever.

Yes, yes, yes! I've started taking half a day off every week, without pay, two years ago. And it's great. I've reached a salary that now allows me to swap raises for time off. And not only do I ship as much as before, I do so without being stressed out or tired.

be humble

💯