What I learned while digging into FactoryGirl’s build_stubbed

Spoiler Alert: I found build_stubbed not viable as a replacement of create​in our test suite. To remove the dependency of the database in tests, I would recommend RSpec’s instance_double instead. Read on to find out why. I was excited to find out that FactoryGirl has methods to create in-memory objects instead of hitting the database. Running a … More What I learned while digging into FactoryGirl’s build_stubbed

Unit Testing: Using Extension Methods for better Exception Catching

Improving unit testing, and use some sleek OOP too. Let’s say that we want to test a call to a basic stored procedure, where @ClientID is required. EXEC MYDB.MYSCHEMA.GetClients @ClientID = 10001 Now we want to test the database call in a unit test.  If we don’t pass in @ClientID, we should expect a SqlException, … More Unit Testing: Using Extension Methods for better Exception Catching