Revert "Remove if defined?(RSpec)"

This reverts commit 9af1074cf6a3f22ffa21a4eb08a6a41bcaf89797.