diff --git a/spec/addressable/uri_spec.rb b/spec/addressable/uri_spec.rb
index <HASH>..<HASH> 100644
--- a/spec/addressable/uri_spec.rb
+++ b/spec/addressable/uri_spec.rb
@@ -27,6 +27,19 @@ $:.uniq!
 
 require 'addressable/uri'
 
+if !"".respond_to?("force_encoding")
+  class String
+    def force_encoding(encoding)
+      # Do nothing, just make sure this gets called.
+    end
+  end
+
+  class Encoding
+    UTF_8 = Encoding.new
+    ASCII_8BIT = Encoding.new
+  end
+end
+
 class ExampleProcessor
   def self.validate(name, value)
     return !!(value =~ /^[\w ]+$/) if name == "query"
Returned to <I>% coverage.