From 6caa2abb56d21e60a408e3765195708da5d94519 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Fri, 10 Jul 2020 11:52:25 -0400 Subject: [PATCH] Add back did_you_mean spec This essentially reverts commit 3a4d6f48. We removed that test because we couldn't get it passing on Ruby 2.3 and 2.4, but we have since removed support for those versions of Ruby. --- spec/factory_bot/registry_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/factory_bot/registry_spec.rb b/spec/factory_bot/registry_spec.rb index 1f42e9a..e793ec6 100644 --- a/spec/factory_bot/registry_spec.rb +++ b/spec/factory_bot/registry_spec.rb @@ -28,6 +28,15 @@ describe FactoryBot::Registry do .to raise_error(KeyError, "Great thing not registered: \"object_name\"") end + it "includes a did_you_mean message" do + registry = FactoryBot::Registry.new(:registry) + registered_object = double(:registered_object) + registry.register(:factory_bot, registered_object) + + expect { registry.find(:factory_bit) } + .to raise_error(KeyError, /Did you mean\? "factory_bot"/) + end + it "adds and returns the object registered" do registry = FactoryBot::Registry.new("Great thing") registered_object = double("registered object")