lib/specdiff/rspec.rb in specdiff-0.3.0.pre.rc1 vs lib/specdiff/rspec.rb in specdiff-0.3.0.rc2
- old
+ new
@@ -1,5 +1,8 @@
+raise "rspec must be required before specdiff/rspec!" unless defined?(RSpec)
+raise "RSpec::Support is missing????" unless defined?(RSpec::Support)
+
class RSpec::Support::Differ
alias old_diff diff
def diff(actual, expected)
diff = ::Specdiff.diff(expected, actual)
@@ -12,22 +15,12 @@
end
# This stops rspec from truncating strings w/ ellipsis, as well as making the
# "inspect" output consistent with specdiff's.
class RSpec::Support::ObjectFormatter
- class SpecdiffCustomInspector < BaseInspector
- def self.can_inspect?(_)
- true
- end
-
- def inspect
- ::Specdiff.diff_inspect(object)
- end
- end
-
- remove_const("INSPECTOR_CLASSES")
- const_set("INSPECTOR_CLASSES", [SpecdiffCustomInspector])
-
def format(object)
::Specdiff.diff_inspect(object)
end
end
+
+# marker for successfully loading this integration
+class Specdiff::RSpecIntegration; end # rubocop: disable Lint/EmptyClass