tarantula 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ doc
7
7
  TAGS
8
8
  coverage
9
9
  *.gem
10
+ Gemfile.lock
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.4.2
2
+ * Fix Response#html? for Rails 3 (jgkite + rsanheim)
3
+ * All tests green again [cldwalker]
4
+
1
5
  v0.2.0 Implementation of updated look-and-feel [Jason Rudolph]
2
6
 
3
7
  v0.1.8 Add timeouts for crawls to help really long builds [Rob Sanheim]
@@ -11,7 +11,7 @@ Tarantula is a big fuzzy spider. It crawls your Rails 3 application, fuzzing dat
11
11
  The latest and greatest version is always available on GitHub. (See the rakefile for dependencies, or
12
12
  just let RubyGems handle it). Add it to your Gemfile as normal:
13
13
 
14
- gem "tarantula", "0.4.1"
14
+ gem "tarantula"
15
15
 
16
16
  === Crawling Your App
17
17
 
@@ -124,13 +124,7 @@ The above will crawl your app twice, and each specific crawl will timeout if it
124
124
 
125
125
  == Bugs/Requests
126
126
 
127
- Please submit your bug reports, patches, or feature requests at Lighthouse:
128
-
129
- http://relevance.lighthouseapp.com/projects/17868-tarantula/overview
130
-
131
- You can view the continuous integration results for Tarantula, including results against all supported versions of Rails, on RunCodeRun here:
132
-
133
- http://runcoderun.com/relevance/tarantula
127
+ Please submit your bug reports, patches, or feature requests in Github Issues.
134
128
 
135
129
  == License
136
130
 
@@ -1,11 +1,13 @@
1
1
  # dynamically mixed in to response objects
2
2
  module Relevance
3
3
  module CoreExtensions
4
- module Response
5
- def html?
4
+ module Response
5
+ def html?
6
6
  # some versions of Rails integration tests don't set content type
7
7
  # so we are treating nil as html. A better fix would be welcome here.
8
- ((content_type =~ %r{^text/html}) != nil) || content_type == nil
8
+ (content_type.respond_to?(:html?) ?
9
+ content_type.html? : content_type =~ %r{^text/html}) ||
10
+ content_type.nil?
9
11
  end
10
12
  end
11
13
  end
@@ -1,15 +1,7 @@
1
- TARANTULA_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "../.."))
2
-
3
1
  require 'forwardable'
4
2
  require 'erb'
5
3
  require 'active_support'
6
4
  require 'action_controller'
7
- # bringing in xss-shield requires a bunch of other dependencies
8
- # still not certain about this, if it ruins your world please let me know
9
- #xss_shield_path = File.join(TARANTULA_ROOT, %w{vendor xss-shield})
10
- #$: << File.join(xss_shield_path, "lib")
11
- #require File.join(xss_shield_path, "init")
12
-
13
5
  require 'htmlentities'
14
6
 
15
7
  module Relevance; end
@@ -5,7 +5,10 @@ module Relevance
5
5
  include Relevance::Tarantula
6
6
  def handle(result)
7
7
  response = result.response
8
- return unless response.html?
8
+ unless response.html?
9
+ log "Skipping #{self.class} on url: #{result.url} because response is not html."
10
+ return
11
+ end
9
12
  begin
10
13
  body = HTML::Document.new(response.body, true)
11
14
  rescue Exception => e
@@ -1,8 +1,6 @@
1
- require 'rubygems'
2
1
  begin
3
- gem 'tidy'
4
2
  require 'tidy'
5
- rescue Gem::LoadError
3
+ rescue LoadError
6
4
  puts "Tidy gem not available -- 'gem install tidy' to get it."
7
5
  end
8
6
 
@@ -12,7 +10,7 @@ if defined? Tidy
12
10
  module Relevance
13
11
  module Tarantula
14
12
 
15
- class TidyHandler
13
+ class TidyHandler
16
14
  include Relevance::Tarantula
17
15
  def initialize(options = {})
18
16
  @options = {:show_warnings=>true}.merge(options)
@@ -1,5 +1,5 @@
1
1
  module Relevance
2
2
  module Tarantula
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
@@ -1,5 +1,4 @@
1
1
  require "spec_helper"
2
- require 'relevance/core_extensions/file'
3
2
 
4
3
  describe "Relevance::CoreExtensions::File#extension" do
5
4
  it "should return the extension without the leading dot" do
@@ -1,29 +1,48 @@
1
1
  require "spec_helper"
2
- require 'relevance/core_extensions/file'
3
2
 
4
3
  describe "Relevance::CoreExtensions::Response#html?" do
5
4
  before do
6
5
  @response = OpenStruct.new
7
6
  @response.extend(Relevance::CoreExtensions::Response)
8
- end
9
-
10
- it "should be html if the content-type is 'text/html'" do
11
- @response.content_type = "text/html"
12
- @response.should be_html
13
- @response.content_type = "text/html;charset=iso-8859-2"
14
- @response.should be_html
15
7
  end
16
8
 
17
- it "should not be html if the content-type isn't an html type" do
18
- @response.content_type = "text/plain"
19
- @response.should_not be_html
9
+ context 'when content_type is a String (Rails 2)' do
10
+ it "should be html if the content-type is 'text/html'" do
11
+ @response.content_type = "text/html"
12
+ @response.should be_html
13
+ @response.content_type = "text/html;charset=iso-8859-2"
14
+ @response.should be_html
15
+ end
16
+
17
+ it "should not be html if the content-type isn't an html type" do
18
+ @response.content_type = "text/plain"
19
+ @response.should_not be_html
20
+ @response.content_type = "application/pdf"
21
+ @response.should_not be_html
22
+ end
20
23
  end
21
24
 
22
- # better ideas welcome, but be careful not to
25
+ context 'when content_type is a Mime::Type (Rails 3)' do
26
+ it "should be html if the content-type is 'text/html'" do
27
+ @response.content_type = Mime::Type.new("text/html")
28
+ @response.should be_html
29
+ @response.content_type = Mime::Type.new("text/html;charset=iso-8859-2")
30
+ @response.should be_html
31
+ end
32
+
33
+ it "should not be html if the content-type isn't an html type" do
34
+ @response.content_type = Mime::Type.new("text/plain")
35
+ @response.should_not be_html
36
+ @response.content_type = Mime::Type.new("application/pdf")
37
+ @response.should_not be_html
38
+ end
39
+ end
40
+
41
+ # better ideas welcome, but be careful not to
23
42
  # castrate tarantula for proxies that don't set the content-type
24
43
  it "should pretend we have html if the content-type is nil" do
25
44
  @response.content_type = nil
26
45
  @response.should be_html
27
46
  end
28
-
47
+
29
48
  end
@@ -1,5 +1,4 @@
1
1
  require "spec_helper"
2
- require 'relevance/core_extensions/test_case'
3
2
 
4
3
  describe "TestCase extensions" do
5
4
  pending "can create the crawler" do
@@ -13,7 +12,7 @@ describe "TestCase extensions" do
13
12
  expects(:tarantula_crawler).returns(crawler)
14
13
  tarantula_crawl(:integration_test_stub, :url => "/foo")
15
14
  end
16
-
15
+
17
16
  it "should get mixed into ActionController::IntegrationTest" do
18
17
  ActionController::IntegrationTest.ancestors.should include(Relevance::CoreExtensions::TestCaseExtensions)
19
18
  end
@@ -57,11 +57,11 @@ describe "Relevance::Tarantula::RailsIntegrationProxy patching" do
57
57
  it "patches in Relevance::CoreExtensions::Response" do
58
58
  @rip = Relevance::Tarantula::RailsIntegrationProxy.new(stub)
59
59
  @rip.stubs(:rails_root).returns("faux_rails_root")
60
- @response = stub_everything({:code => "404", :headers => {}, :content_type => "text/html"})
60
+ @response = stub_everything({:code => "404", :headers => {}, :content_type => Mime::Type.new("text/html")})
61
61
  @response.meta.ancestors.should_not include(Relevance::CoreExtensions::Response)
62
62
  @rip.patch_response("/url", @response)
63
63
  @response.meta.ancestors.should include(Relevance::CoreExtensions::Response)
64
- @response.html?.should == true
64
+ @response.should be_html
65
65
  end
66
66
 
67
67
  it "replaces 404s with 200s, pulling content from public, for known text types" do
@@ -1,8 +1,5 @@
1
- require 'rubygems'
2
- lib_path = File.expand_path(File.dirname(__FILE__) + "/../lib")
3
- $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
4
-
5
1
  if rails_version = ENV['RAILS_VERSION']
2
+ require 'rubygems'
6
3
  gem "rails", rails_version
7
4
  end
8
5
 
@@ -13,6 +10,7 @@ if Rails::VERSION::STRING < "2.3.1" && RUBY_VERSION >= "1.9.1"
13
10
  end
14
11
  puts "==== Testing with Rails #{Rails::VERSION::STRING} ===="
15
12
 
13
+ require 'relevance/tarantula'
16
14
  require 'bundler'
17
15
  Bundler.require
18
16
  require 'ostruct'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarantula
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-22 00:00:00.000000000Z
12
+ date: 2012-02-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: htmlentities
16
- requirement: &24434960 !ruby/object:Gem::Requirement
16
+ requirement: &70348248358760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 4.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *24434960
24
+ version_requirements: *70348248358760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hpricot
27
- requirement: &24434460 !ruby/object:Gem::Requirement
27
+ requirement: &70348248358220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.8.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *24434460
35
+ version_requirements: *70348248358220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &24434000 !ruby/object:Gem::Requirement
38
+ requirement: &70348248357700 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.6.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *24434000
46
+ version_requirements: *70348248357700
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sdoc
49
- requirement: &24433540 !ruby/object:Gem::Requirement
49
+ requirement: &70348248357240 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.3.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *24433540
57
+ version_requirements: *70348248357240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sdoc-helpers
60
- requirement: &24433080 !ruby/object:Gem::Requirement
60
+ requirement: &70348248356660 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.1.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *24433080
68
+ version_requirements: *70348248356660
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdiscount
71
- requirement: &24432620 !ruby/object:Gem::Requirement
71
+ requirement: &70348248356080 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.6.8
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *24432620
79
+ version_requirements: *70348248356080
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: log_buddy
82
- requirement: &24432160 !ruby/object:Gem::Requirement
82
+ requirement: &70348248339640 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.6.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *24432160
90
+ version_requirements: *70348248339640
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: mocha
93
- requirement: &24431700 !ruby/object:Gem::Requirement
93
+ requirement: &70348248339060 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 0.9.12
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *24431700
101
+ version_requirements: *70348248339060
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rails
104
- requirement: &24431240 !ruby/object:Gem::Requirement
104
+ requirement: &70348248338480 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 3.0.9
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *24431240
112
+ version_requirements: *70348248338480
113
113
  description: A big hairy fuzzy spider that crawls your site, wreaking havoc
114
114
  email:
115
115
  - opensource@thinkrelevance.com
@@ -120,10 +120,10 @@ files:
120
120
  - .autotest
121
121
  - .gitignore
122
122
  - .rvmrc
123
+ - .travis.yml
123
124
  - CHANGELOG
124
125
  - DSL_EXAMPLES.md
125
126
  - Gemfile
126
- - Gemfile.lock
127
127
  - LICENSE
128
128
  - README.rdoc
129
129
  - Rakefile
@@ -224,8 +224,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  version: '0'
225
225
  requirements: []
226
226
  rubyforge_project: tarantula
227
- rubygems_version: 1.8.6
227
+ rubygems_version: 1.8.15
228
228
  signing_key:
229
229
  specification_version: 3
230
230
  summary: A big hairy fuzzy spider that crawls your site, wreaking havoc
231
- test_files: []
231
+ test_files:
232
+ - template/tarantula_test.rb
@@ -1,108 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- relevance/tarantula (0.4.0)
5
- hpricot (~> 0.8.4)
6
- htmlentities (~> 4.3.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- abstract (1.0.0)
12
- actionmailer (3.0.10)
13
- actionpack (= 3.0.10)
14
- mail (~> 2.2.19)
15
- actionpack (3.0.10)
16
- activemodel (= 3.0.10)
17
- activesupport (= 3.0.10)
18
- builder (~> 2.1.2)
19
- erubis (~> 2.6.6)
20
- i18n (~> 0.5.0)
21
- rack (~> 1.2.1)
22
- rack-mount (~> 0.6.14)
23
- rack-test (~> 0.5.7)
24
- tzinfo (~> 0.3.23)
25
- activemodel (3.0.10)
26
- activesupport (= 3.0.10)
27
- builder (~> 2.1.2)
28
- i18n (~> 0.5.0)
29
- activerecord (3.0.10)
30
- activemodel (= 3.0.10)
31
- activesupport (= 3.0.10)
32
- arel (~> 2.0.10)
33
- tzinfo (~> 0.3.23)
34
- activeresource (3.0.10)
35
- activemodel (= 3.0.10)
36
- activesupport (= 3.0.10)
37
- activesupport (3.0.10)
38
- arel (2.0.10)
39
- builder (2.1.2)
40
- diff-lcs (1.1.2)
41
- erubis (2.6.6)
42
- abstract (>= 1.0.0)
43
- hpricot (0.8.4)
44
- htmlentities (4.3.0)
45
- i18n (0.5.0)
46
- json (1.5.3)
47
- log_buddy (0.6.0)
48
- mail (2.2.19)
49
- activesupport (>= 2.3.6)
50
- i18n (>= 0.4.0)
51
- mime-types (~> 1.16)
52
- treetop (~> 1.4.8)
53
- mime-types (1.16)
54
- mocha (0.9.12)
55
- polyglot (0.3.2)
56
- rack (1.2.3)
57
- rack-mount (0.6.14)
58
- rack (>= 1.0.0)
59
- rack-test (0.5.7)
60
- rack (>= 1.0)
61
- rails (3.0.10)
62
- actionmailer (= 3.0.10)
63
- actionpack (= 3.0.10)
64
- activerecord (= 3.0.10)
65
- activeresource (= 3.0.10)
66
- activesupport (= 3.0.10)
67
- bundler (~> 1.0)
68
- railties (= 3.0.10)
69
- railties (3.0.10)
70
- actionpack (= 3.0.10)
71
- activesupport (= 3.0.10)
72
- rake (>= 0.8.7)
73
- rdoc (~> 3.4)
74
- thor (~> 0.14.4)
75
- rake (0.9.2)
76
- rdiscount (1.6.8)
77
- rdoc (3.9.2)
78
- rspec (2.6.0)
79
- rspec-core (~> 2.6.0)
80
- rspec-expectations (~> 2.6.0)
81
- rspec-mocks (~> 2.6.0)
82
- rspec-core (2.6.4)
83
- rspec-expectations (2.6.0)
84
- diff-lcs (~> 1.1.2)
85
- rspec-mocks (2.6.0)
86
- sdoc (0.3.0)
87
- json (>= 1.1.3)
88
- rdoc (~> 3)
89
- sdoc-helpers (0.1.4)
90
- sdoc (~> 0.2)
91
- thor (0.14.6)
92
- treetop (1.4.10)
93
- polyglot
94
- polyglot (>= 0.3.1)
95
- tzinfo (0.3.29)
96
-
97
- PLATFORMS
98
- ruby
99
-
100
- DEPENDENCIES
101
- log_buddy (~> 0.6.0)
102
- mocha (~> 0.9.12)
103
- rails (~> 3.0.9)
104
- rdiscount (~> 1.6.8)
105
- relevance/tarantula!
106
- rspec (~> 2.6.0)
107
- sdoc (~> 0.3.0)
108
- sdoc-helpers (~> 0.1.4)