Permalink
Browse files

basic integration test.

  • Loading branch information...
1 parent 3258ff0 commit 05e39c8408bb3205b0db919df585397fe74ccee1 @botandrose committed Dec 26, 2011
View
@@ -1 +1,6 @@
require "bundler/gem_tasks"
+require "rspec/core/rake_task"
+
+RSpec::Core::RakeTask.new(:spec)
+
+task :default => :spec
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,31 @@
+require "rack/test"
+require "sprockets"
+require "sprockets/image_compressor"
+
+describe "sprockets integration" do
+ include Rack::Test::Methods
+
+ let(:app) do
+ Sprockets::Environment.new.tap do |environment|
+ environment.register_postprocessor 'image/png', :png_compressor do |context, data|
+ Sprockets::ImageCompressor::PngCompressor.new.compress data
+ end
+ environment.register_postprocessor 'image/jpeg', :jpg_compressor do |context, data|
+ Sprockets::ImageCompressor::JpgCompressor.new.compress data
+ end
+ environment.append_path "spec/fixtures"
+ end
+ end
+
+ it "should compress pngs" do
+ get "/largepng.png"
+ last_response.should be_ok
+ last_response.headers["Content-Length"].should == "116773"
+ end
+
+ it "should compress jpgs" do
+ get "/largejpg.jpg"
+ last_response.should be_ok
+ last_response.headers["Content-Length"].should == "4000"
+ end
+end
@@ -18,7 +18,9 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- # specify any dependencies here; for example:
- # s.add_development_dependency "rspec"
- # s.add_runtime_dependency "rest-client"
+ s.add_runtime_dependency "sprockets"
+
+ s.add_development_dependency "ruby-debug"
+ s.add_development_dependency "rspec"
+ s.add_development_dependency "rack-test"
end

0 comments on commit 05e39c8

Please sign in to comment.