javascript_eraser 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -10,7 +10,7 @@ class JavascriptEraser
10
10
  response = ""
11
11
  elsif response.respond_to?(:body) and response.body.is_a?(String)
12
12
  response.body = response.body.gsub(/<script(.|\n)*?type(.|\n)*?javascript(.|\n)*?\/script>/,"")
13
- elsif response.class != "Rack::File"
13
+ elsif response.class.to_s != "Rack::File"
14
14
  puts "JavascriptEraser: unknown response type: #{response.class}. check order of appearance in middleware stack."
15
15
  end
16
16
 
@@ -16,5 +16,18 @@ describe "JavascriptEraser" do
16
16
  je = JavascriptEraser.new( lambda { |env| [200, {}, Response.new] } )
17
17
  je.call(nil)[2].body.should == "blah "
18
18
  end
19
+
20
+ it "should log a message if the response type is unknown" do
21
+ je = JavascriptEraser.new( lambda { |env| [200, {}, {}] } )
22
+ $stdout.should_receive(:write).at_least(1).times
23
+ je.call(nil)
24
+ end
25
+
26
+ it "should not log a message if the response type is Rack::File" do
27
+ module Rack; class File; end; end;
28
+ je = JavascriptEraser.new( lambda { |env| [200, {}, Rack::File.new] } )
29
+ $stdout.should_receive(:write).exactly(0).times
30
+ je.call(nil)
31
+ end
19
32
  end
20
33
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: javascript_eraser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Boyd