From b444abdb596afd7737963c6b30ba87000727082c Mon Sep 17 00:00:00 2001 From: Phil Pirozhkov Date: Fri, 8 Jan 2021 10:29:32 +0300 Subject: [PATCH] Use true/false for previously_defined ``` 1) RSpec::Mocks::Constant.original for a previously defined unstubbed constant indicates it was previously defined Failure/Error: it("indicates it was previously defined") { expect(const).to be_previously_defined } expected `#.previously_defined?` to return true, got [:m, "TestClass::M"] # ./spec/rspec/mocks/mutate_const_spec.rb:446:in `block (4 levels) in ' ``` --- lib/rspec/mocks/mutate_const.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rspec/mocks/mutate_const.rb b/lib/rspec/mocks/mutate_const.rb index 5bc107306..6ce67a0f8 100644 --- a/lib/rspec/mocks/mutate_const.rb +++ b/lib/rspec/mocks/mutate_const.rb @@ -66,7 +66,7 @@ def to_s # @private def self.unmutated(name) - previously_defined = recursive_const_defined?(name) + previously_defined = !!recursive_const_defined?(name) rescue NameError new(name) do |c| c.valid_name = false