RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Submit a post

You can use basic HTML markup (e.g. <a>) or Markdown.
Note that your post may be edited to suit the format of the site.

As you are not logged in, you will be
directed via GitHub to signup or sign in

Post Preview

Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.

RSpec Mocks and Stubs in Plain English

One of the most common questions I see from beginners to Rails testing is what mocks and stubs are and when to use them. https://www.codewithjason.com/rspec-mocks-stubs-plain-english/ If you’re confused about mocks and stubs, you’re not alone. In my experience very few people understand them. In this post I’ll attempt to help clarify the matter, particularly in the context of Rails/RSpec. [more inside]

ValueSemantics—A Gem for Making Value Classes

ValueSemantics is a gem for making value classes, with attribute defaults, validation, and coercion. This article also covers some of its design considerations, such as using exceptions to catch developer mistakes, extensibility, being unobtrusive, integration continuity, stability, thin DSLs, and “no setters” immutability.

How to Tell the Difference Between a Default and a Provided Value for Optional Argume

It is sometimes required for the methods with optional arguments to be able to differentiate between its default value and the value passed from the caller. Passing nil might initially sound like a good idea since it represents “nothingness”. However, it might turn out that nil is a legit value and there might be cases where it is desirable for the caller to pass nil. In such a case, we cannot use it as a default value if we want to implement a special logic for the case of not providing that value. [more inside]

Loading older posts