Browse files

Faster specs

  • Loading branch information...
1 parent c20aaa8 commit 1ff9bfdef3dc8355e095ca75d9c46bf347f1f837 @lautis committed Jun 29, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 spec/uglifier_spec.rb
View
9 spec/uglifier_spec.rb
@@ -1,4 +1,5 @@
# encoding: UTF-8
+require 'stringio'
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Uglifier" do
@@ -120,15 +121,17 @@
end
describe "Input Formats" do
+ let(:code) { "function hello() { return 'hello world'; }" }
+
it "handles strings" do
lambda {
- Uglifier.new.compile(File.open("lib/uglify.js", "r:UTF-8").read).should_not be_empty
+ Uglifier.new.compile(code).should_not be_empty
}.should_not raise_error
end
- it "handles files" do
+ it "handles IO objects" do
lambda {
- Uglifier.new.compile(File.open("lib/uglify.js", "r:UTF-8")).should_not be_empty
+ Uglifier.new.compile(StringIO.new(code)).should_not be_empty
}.should_not raise_error
end
end

0 comments on commit 1ff9bfd

Please sign in to comment.