LJLewis Jonesinljones140.hashnode.dev·May 10, 2021 · 5 min readAre we being lazy with memoization?Sometimes we need to memoize/cache expensive operations. A typical case is to avoid multiple database calls. A common Ruby technique is to use the lazy evaluation operator ||= def customer @customer ||= Customer.find(@customer_id) end If @cu...00
LJLewis Jonesinljones140.hashnode.dev·May 6, 2021 · 7 min readIs the RSpec DSL making your tests harder to read?You're working on a Ruby app that uses RSpec. You push a commit, the CI fails. The output points to this test. it 'has attributes from params' do expect(subject).to have_attributes(params) end Is this a good test? I suppose it's one line method? ...00