Sha256: 9ff42d243f20a1945d350ff0c3b1a7241e2c82346c4016caf124ba187d852d75
Contents?: true
Size: 778 Bytes
Versions: 1
Compression:
Stored size: 778 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "JavascriptEraser" do it "should be a middleware" do JavascriptEraser.new(lambda{}).should be_respond_to(:call) end describe "#call" do it "should erase the whole body if it's a javascript content type" do je = JavascriptEraser.new( lambda { |env| [200, { "Content-Type" => "text/javascript" }, "blah"] } ) je.call(nil)[2].should == "" end it "should erase the javascript tags if it's html" do class Response; attr_accessor :body; def initialize; @body="blah <script type='text/javascript'>doStuff();</script>"; end; end je = JavascriptEraser.new( lambda { |env| [200, {}, Response.new] } ) je.call(nil)[2].body.should == "blah " end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
javascript_eraser-1.0.0 | spec/javascript_eraser_spec.rb |