Difference between "let" and "before each" in Rspec
Rspec is a great ruby library for writing tests (or “specs” as they are called in Rspec). It includes lots of great helper methods that can help you save time and write faster more performant tests. Often times when you’re writing a test you need to prepare some data or do some action before that test gets run. RSpec provides 2 main ways of achieving this: Via the let statement. Via the before :each statement. But what’s the difference between the two? In short, let blocks are “lazy” and only gets evaluated the first time they are called in your... Read more »