Hacker News new | ask | show | jobs
by jack_riminton 761 days ago
Interesting! I wonder how this could be applied to a Rails project (since that's what ruby is most used for). For example how would it know to test a wide selection of possible values for different variables if they're not explicitly set up?
2 comments

I imagine it wouldn't be too hard to build up your own data generators for Rails models (or other entities).
Yeah, the easiest way is to generate attributes and instantiate any Rails model like the one below:

    Pbt.assert do
      Pbt.property(name: Pbt.printable_string, age: Pbt.integer(min: 0, max: 100)) do |name:, age:|
        user = User.new(name: name, age: age)
        # write your test here
      end
    end
> Rails [...] that's what ruby is most used for

I wish that wasn't the case, I use Ruby heavily for gluing different systems together.

Outside of language level preferences, is there something about the ecosystem around Ruby that makes it particularly well suited to this? I would have thought Python was the glue language winner just because there are already bindings to the entire universe available for it.
Ruby just simply isn’t the glue language winner because of the heavy emphasis on rails.

From a systems perspective, I had to switch to python because it has pyroute2, which supports rtnl, devlink, ethtool and more.

I would have thought ruby had a full-fledged netlink library right now considering the stability of chef and puppet.

But all I could find was this from 8 years ago: https://github.com/BytemarkHosting/netlinkrb

I started off with ruby for systems glue but now I have a mix of python and ruby. I wish it was all ruby but the lack of updated “glue gems” and the prevalence of updated “glue eggs” means python really is the “glue language winner”.

> I wish it was all ruby

Why do you not wish it was all Python?

My answer to this would be: This is totally personal, but for me Ruby is just a language that allows concisely and readable way express myself to get stuff done. Python just does not read so good and forces to do more boiler-plate. Probably skill-issue, but I knew Python before Ruby, so :shrug: To give out any examples, I would need to have some Python code on me, but I don't :D
I’d say simply because of language preference
> all I could find was this from 8 years ago: https://github.com/BytemarkHosting/netlinkrb

Yeah, that's so typical. I've almost become used to this, seeing useful gems being very old. To me, I see that as either abandoned (which means I have to fork it and polish it) or the gem is considered complete.

Ruby is my choice primarily because of its syntax and the powerful meta-programming capabilities. The ecosystem in itself is not any richer or better than Python, no, Python has faaar superior libraries and vibrant support. In my case, I've found ruby-toolbox.com to be useful when I need to scavenge for libraries.