Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More calls to force_encoding without a guard

  • Loading branch information...
commit b82cc0b6863be92e1a42e1a861f64c14811f94a0 1 parent ab57769
@wycats authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 spec/stringify_spec.rb
View
8 spec/stringify_spec.rb
@@ -16,9 +16,10 @@ def should_equal_itself(string, should)
end
def should_match_compressed(string)
- should = Uglifier.new.compile(string.force_encoding("UTF-8"))
+ string.force_encoding("UTF-8") if string.respond_to?(:force_encoding)
+ should = Uglifier.new.compile(string)
- string.force_encoding("BINARY")
+ string.force_encoding("BINARY") if string.respond_to?(:force_encoding)
ast = ParseJS.parse(string)
new_string = ParseJS::Stringifier.to_string(ast) do |stringifier|
@@ -26,7 +27,8 @@ def should_match_compressed(string)
end
File.open("ewot", "w") { |file| file.puts new_string }
- new_string = Uglifier.new.compile(new_string.force_encoding("UTF-8"))
+ new_string.force_encoding("UTF-8") if new_string.respond_to?(:force_encoding)
+ new_string = Uglifier.new.compile(new_string)
new_string.split(";").should == should.split(";")
end
Please sign in to comment.
Something went wrong with that request. Please try again.