I am a beginner in Ruby and had this question nagging me for a long time.
In an RSpec file , if we write
Book.should <do something>
Upon loading, RSpec includes a module into the
Kernel module which is included into all objects known to Ruby. Thus, it can make the should method available to all objects. As such,
should is not a keyword (like
end) but an ordinary method.
Note that that mixin is only available in RSpec contexts as it is "patched in" during loading or RSpec.