mechanize 2.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mechanize might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/.autotest +6 -0
- data/CHANGELOG.rdoc +12 -1
- data/Manifest.txt +1 -0
- data/Rakefile +4 -2
- data/lib/mechanize.rb +23 -13
- data/lib/mechanize/cookie_jar.rb +13 -7
- data/test/helper.rb +1 -1
- data/test/test_cookies.rb +12 -12
- data/test/test_form_action.rb +1 -1
- data/test/test_form_as_hash.rb +5 -7
- data/test/test_form_button.rb +1 -1
- data/test/test_frames.rb +1 -1
- data/test/test_headers.rb +1 -1
- data/test/test_history.rb +1 -1
- data/test/test_history_added.rb +1 -1
- data/test/test_html_unscape_forms.rb +1 -1
- data/test/test_if_modified_since.rb +1 -1
- data/test/test_images.rb +1 -1
- data/test/test_mechanize.rb +45 -27
- data/test/test_mechanize_cookie.rb +6 -6
- data/test/test_mechanize_cookie_jar.rb +5 -4
- data/test/test_mechanize_file.rb +1 -1
- data/test/test_mechanize_file_request.rb +1 -1
- data/test/test_mechanize_file_response.rb +1 -1
- data/test/test_mechanize_form.rb +148 -233
- data/test/test_mechanize_form_check_box.rb +1 -1
- data/test/test_mechanize_form_encoding.rb +8 -6
- data/test/test_mechanize_form_field.rb +1 -1
- data/test/test_mechanize_form_image_button.rb +1 -1
- data/test/test_mechanize_form_textarea.rb +9 -3
- data/test/test_mechanize_http_agent.rb +2 -2
- data/test/test_mechanize_link.rb +8 -7
- data/test/test_mechanize_page_encoding.rb +1 -1
- data/test/test_mechanize_page_link.rb +5 -2
- data/test/test_mechanize_page_meta_refresh.rb +1 -1
- data/test/test_mechanize_redirect_not_get_or_head_error.rb +1 -1
- data/test/test_mechanize_subclass.rb +1 -1
- data/test/test_mechanize_util.rb +18 -18
- data/test/test_multi_select.rb +1 -1
- data/test/test_no_attributes.rb +4 -4
- data/test/test_option.rb +1 -1
- data/test/test_pluggable_parser.rb +11 -20
- data/test/test_post_form.rb +9 -13
- data/test/test_pretty_print.rb +1 -1
- data/test/test_radiobutton.rb +1 -1
- data/test/test_redirect_limit_reached.rb +1 -1
- data/test/test_referer.rb +1 -1
- data/test/test_relative_links.rb +2 -2
- data/test/test_request.rb +1 -1
- data/test/test_response_code.rb +1 -1
- data/test/test_robots.rb +18 -29
- data/test/test_save_file.rb +1 -1
- data/test/test_scheme.rb +3 -3
- data/test/test_select.rb +5 -2
- data/test/test_select_all.rb +1 -1
- data/test/test_select_none.rb +1 -1
- data/test/test_select_noopts.rb +5 -3
- data/test/test_set_fields.rb +1 -1
- data/test/test_ssl_server.rb +1 -1
- metadata +23 -5
- metadata.gz.sig +1 -2
data/test/test_pretty_print.rb
CHANGED
data/test/test_radiobutton.rb
CHANGED
data/test/test_referer.rb
CHANGED
data/test/test_relative_links.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
class TestRelativeLinks <
|
3
|
+
class TestRelativeLinks < MiniTest::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@agent = Mechanize.new
|
6
6
|
end
|
@@ -14,7 +14,7 @@ class TestRelativeLinks < Test::Unit::TestCase
|
|
14
14
|
def test_too_many_dots
|
15
15
|
@page = @agent.get("http://localhost/relative/tc_relative_links.html")
|
16
16
|
page = @page.link_with(:text => 'too many dots').click
|
17
|
-
|
17
|
+
|
18
18
|
assert_equal('http://localhost/tc_relative_links.html', page.uri.to_s)
|
19
19
|
end
|
20
20
|
|
data/test/test_request.rb
CHANGED
data/test/test_response_code.rb
CHANGED
data/test/test_robots.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
class TestRobots <
|
3
|
+
class TestRobots < MiniTest::Unit::TestCase
|
4
4
|
|
5
5
|
def setup
|
6
6
|
@mech = Mechanize.new
|
@@ -12,9 +12,9 @@ class TestRobots < Test::Unit::TestCase
|
|
12
12
|
def test_robots
|
13
13
|
assert_equal "Welcome!", @robot.get("http://localhost/robots.html").title
|
14
14
|
|
15
|
-
|
15
|
+
assert_raises Mechanize::RobotsDisallowedError do
|
16
16
|
@robot.get("http://localhost/norobots.html")
|
17
|
-
|
17
|
+
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_robots_allowed_eh
|
@@ -28,55 +28,44 @@ class TestRobots < Test::Unit::TestCase
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_noindex
|
31
|
-
|
32
|
-
@mech.get("http://localhost/noindex.html")
|
33
|
-
}
|
31
|
+
@mech.get("http://localhost/noindex.html")
|
34
32
|
|
35
33
|
assert @robot.agent.robots_allowed? URI("http://localhost/noindex.html")
|
36
34
|
|
37
|
-
|
35
|
+
assert_raises Mechanize::RobotsDisallowedError do
|
38
36
|
@robot.get("http://localhost/noindex.html")
|
39
|
-
|
37
|
+
end
|
40
38
|
end
|
41
39
|
|
42
40
|
def test_nofollow
|
43
41
|
page = @mech.get("http://localhost/nofollow.html")
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
}
|
48
|
-
assert_nothing_raised {
|
49
|
-
page.links[1].click
|
50
|
-
}
|
43
|
+
page.links[0].click
|
44
|
+
page.links[1].click
|
51
45
|
|
52
46
|
page = @robot.get("http://localhost/nofollow.html")
|
53
47
|
|
54
|
-
|
48
|
+
assert_raises Mechanize::RobotsDisallowedError do
|
55
49
|
page.links[0].click
|
56
|
-
|
57
|
-
|
50
|
+
end
|
51
|
+
assert_raises Mechanize::RobotsDisallowedError do
|
58
52
|
page.links[1].click
|
59
|
-
|
53
|
+
end
|
60
54
|
end
|
61
55
|
|
62
56
|
def test_rel_nofollow
|
63
57
|
page = @mech.get("http://localhost/rel_nofollow.html")
|
64
58
|
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
assert_nothing_raised {
|
69
|
-
page.links[1].click
|
70
|
-
}
|
59
|
+
page.links[0].click
|
60
|
+
page.links[1].click
|
71
61
|
|
72
62
|
page = @robot.get("http://localhost/rel_nofollow.html")
|
73
63
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
assert_raise(Mechanize::RobotsDisallowedError) {
|
64
|
+
page.links[0].click
|
65
|
+
|
66
|
+
assert_raises Mechanize::RobotsDisallowedError do
|
78
67
|
page.links[1].click
|
79
|
-
|
68
|
+
end
|
80
69
|
end
|
81
70
|
|
82
71
|
end
|
data/test/test_save_file.rb
CHANGED
data/test/test_scheme.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
class SchemeTest <
|
3
|
+
class SchemeTest < MiniTest::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@agent = Mechanize.new
|
6
6
|
@agent.log = Class.new(Object) do
|
@@ -34,15 +34,15 @@ class SchemeTest < Test::Unit::TestCase
|
|
34
34
|
f = File.expand_path(File.join(File.dirname(__FILE__), "htdocs"))
|
35
35
|
page = @agent.get("file://#{f}")
|
36
36
|
link = page.links.find { |l| l.text =~ /tc_follow_meta/ }
|
37
|
-
|
37
|
+
|
38
38
|
path = URI.parse(link.href).path
|
39
39
|
|
40
40
|
page = link.click
|
41
41
|
assert_equal(File.read(path), page.body)
|
42
42
|
|
43
43
|
link = page.meta_refresh.first
|
44
|
-
assert_not_nil(link)
|
45
44
|
page = @agent.click(link)
|
45
|
+
|
46
46
|
assert_equal("http://localhost/index.html", @agent.history.last.uri.to_s)
|
47
47
|
end
|
48
48
|
end
|
data/test/test_select.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
class SelectTest <
|
3
|
+
class SelectTest < MiniTest::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@agent = Mechanize.new
|
6
6
|
@page = @agent.get("http://localhost/form_select.html")
|
@@ -34,11 +34,14 @@ class SelectTest < Test::Unit::TestCase
|
|
34
34
|
|
35
35
|
def test_click_all
|
36
36
|
@form.field_with(:name => 'list').options.each { |o| o.click }
|
37
|
+
|
37
38
|
option_list = @form.field_with(:name => 'list').options
|
38
|
-
|
39
|
+
|
39
40
|
assert_equal(6, option_list.length)
|
40
41
|
assert_equal(option_list.last.value, @form.list)
|
42
|
+
|
41
43
|
page = @agent.submit(@form)
|
44
|
+
|
42
45
|
assert_equal(1, page.links.length)
|
43
46
|
assert_equal(1, page.links_with(:text => "list:#{option_list.last}").length)
|
44
47
|
end
|
data/test/test_select_all.rb
CHANGED
data/test/test_select_none.rb
CHANGED
data/test/test_select_noopts.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "helper"
|
2
2
|
|
3
|
-
class SelectNoOptionsTest <
|
3
|
+
class SelectNoOptionsTest < MiniTest::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@agent = Mechanize.new
|
6
6
|
@page = @agent.get("http://localhost/form_select_noopts.html")
|
@@ -8,9 +8,11 @@ class SelectNoOptionsTest < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_select_default
|
11
|
-
|
12
|
-
assert_nil
|
11
|
+
assert @form.field('list')
|
12
|
+
assert_nil @form.list
|
13
|
+
|
13
14
|
page = @agent.submit(@form)
|
15
|
+
|
14
16
|
assert_equal(0, page.links.length)
|
15
17
|
end
|
16
18
|
end
|
data/test/test_set_fields.rb
CHANGED
data/test/test_ssl_server.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mechanize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 2.0.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Eric Hodel
|
@@ -37,7 +38,7 @@ cert_chain:
|
|
37
38
|
x52qPcexcYZR7w==
|
38
39
|
-----END CERTIFICATE-----
|
39
40
|
|
40
|
-
date: 2011-06-
|
41
|
+
date: 2011-06-28 00:00:00 Z
|
41
42
|
dependencies:
|
42
43
|
- !ruby/object:Gem::Dependency
|
43
44
|
name: nokogiri
|
@@ -116,9 +117,25 @@ dependencies:
|
|
116
117
|
type: :runtime
|
117
118
|
version_requirements: *id004
|
118
119
|
- !ruby/object:Gem::Dependency
|
119
|
-
name:
|
120
|
+
name: minitest
|
120
121
|
prerelease: false
|
121
122
|
requirement: &id005 !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
hash: 1
|
128
|
+
segments:
|
129
|
+
- 2
|
130
|
+
- 3
|
131
|
+
- 1
|
132
|
+
version: 2.3.1
|
133
|
+
type: :development
|
134
|
+
version_requirements: *id005
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: hoe
|
137
|
+
prerelease: false
|
138
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
122
139
|
none: false
|
123
140
|
requirements:
|
124
141
|
- - ~>
|
@@ -129,7 +146,7 @@ dependencies:
|
|
129
146
|
- 9
|
130
147
|
version: "2.9"
|
131
148
|
type: :development
|
132
|
-
version_requirements: *
|
149
|
+
version_requirements: *id006
|
133
150
|
description: |-
|
134
151
|
The Mechanize library is used for automating interaction with websites.
|
135
152
|
Mechanize automatically stores and sends cookies, follows redirects,
|
@@ -153,6 +170,7 @@ extra_rdoc_files:
|
|
153
170
|
- LICENSE.rdoc
|
154
171
|
- README.rdoc
|
155
172
|
files:
|
173
|
+
- .autotest
|
156
174
|
- CHANGELOG.rdoc
|
157
175
|
- EXAMPLES.rdoc
|
158
176
|
- FAQ.rdoc
|
metadata.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
��9����'�E�Vd���4�/=��}[<��!a���B96@�cBW ����{LO|��`�����
|
1
|
+
�}=x�1�1+h��5�lP0�����Jz�8��+˘�1�$�箇���ՙ_��w�m\u'���*�=��:�����zV�7N��/����I��DC���L���
|