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.

Files changed (62) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +6 -0
  3. data/CHANGELOG.rdoc +12 -1
  4. data/Manifest.txt +1 -0
  5. data/Rakefile +4 -2
  6. data/lib/mechanize.rb +23 -13
  7. data/lib/mechanize/cookie_jar.rb +13 -7
  8. data/test/helper.rb +1 -1
  9. data/test/test_cookies.rb +12 -12
  10. data/test/test_form_action.rb +1 -1
  11. data/test/test_form_as_hash.rb +5 -7
  12. data/test/test_form_button.rb +1 -1
  13. data/test/test_frames.rb +1 -1
  14. data/test/test_headers.rb +1 -1
  15. data/test/test_history.rb +1 -1
  16. data/test/test_history_added.rb +1 -1
  17. data/test/test_html_unscape_forms.rb +1 -1
  18. data/test/test_if_modified_since.rb +1 -1
  19. data/test/test_images.rb +1 -1
  20. data/test/test_mechanize.rb +45 -27
  21. data/test/test_mechanize_cookie.rb +6 -6
  22. data/test/test_mechanize_cookie_jar.rb +5 -4
  23. data/test/test_mechanize_file.rb +1 -1
  24. data/test/test_mechanize_file_request.rb +1 -1
  25. data/test/test_mechanize_file_response.rb +1 -1
  26. data/test/test_mechanize_form.rb +148 -233
  27. data/test/test_mechanize_form_check_box.rb +1 -1
  28. data/test/test_mechanize_form_encoding.rb +8 -6
  29. data/test/test_mechanize_form_field.rb +1 -1
  30. data/test/test_mechanize_form_image_button.rb +1 -1
  31. data/test/test_mechanize_form_textarea.rb +9 -3
  32. data/test/test_mechanize_http_agent.rb +2 -2
  33. data/test/test_mechanize_link.rb +8 -7
  34. data/test/test_mechanize_page_encoding.rb +1 -1
  35. data/test/test_mechanize_page_link.rb +5 -2
  36. data/test/test_mechanize_page_meta_refresh.rb +1 -1
  37. data/test/test_mechanize_redirect_not_get_or_head_error.rb +1 -1
  38. data/test/test_mechanize_subclass.rb +1 -1
  39. data/test/test_mechanize_util.rb +18 -18
  40. data/test/test_multi_select.rb +1 -1
  41. data/test/test_no_attributes.rb +4 -4
  42. data/test/test_option.rb +1 -1
  43. data/test/test_pluggable_parser.rb +11 -20
  44. data/test/test_post_form.rb +9 -13
  45. data/test/test_pretty_print.rb +1 -1
  46. data/test/test_radiobutton.rb +1 -1
  47. data/test/test_redirect_limit_reached.rb +1 -1
  48. data/test/test_referer.rb +1 -1
  49. data/test/test_relative_links.rb +2 -2
  50. data/test/test_request.rb +1 -1
  51. data/test/test_response_code.rb +1 -1
  52. data/test/test_robots.rb +18 -29
  53. data/test/test_save_file.rb +1 -1
  54. data/test/test_scheme.rb +3 -3
  55. data/test/test_select.rb +5 -2
  56. data/test/test_select_all.rb +1 -1
  57. data/test/test_select_none.rb +1 -1
  58. data/test/test_select_noopts.rb +5 -3
  59. data/test/test_set_fields.rb +1 -1
  60. data/test/test_ssl_server.rb +1 -1
  61. metadata +23 -5
  62. metadata.gz.sig +1 -2
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class TestPrettyPrint < Test::Unit::TestCase
3
+ class TestPrettyPrint < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @agent = Mechanize.new
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class TestRadioButtons < Test::Unit::TestCase
3
+ class TestRadioButtons < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @agent = Mechanize.new
6
6
  @page = @agent.get("http://localhost/tc_radiobuttons.html")
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class TestRedirectLimitReached < Test::Unit::TestCase
3
+ class TestRedirectLimitReached < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @agent = Mechanize.new
6
6
  end
data/test/test_referer.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class RefererTest < Test::Unit::TestCase
3
+ class RefererTest < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @agent = Mechanize.new
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class TestRelativeLinks < Test::Unit::TestCase
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
- assert_not_nil(page)
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
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class RequestTest < Test::Unit::TestCase
3
+ class RequestTest < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @agent = Mechanize.new
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class ResponseCodeMechTest < Test::Unit::TestCase
3
+ class ResponseCodeMechTest < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @mech = Mechanize.new
6
6
  end
data/test/test_robots.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class TestRobots < Test::Unit::TestCase
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
- assert_raise(Mechanize::RobotsDisallowedError) {
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
- assert_nothing_raised {
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
- assert_raise(Mechanize::RobotsDisallowedError) {
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
- assert_nothing_raised {
46
- page.links[0].click
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
- assert_raise(Mechanize::RobotsDisallowedError) {
48
+ assert_raises Mechanize::RobotsDisallowedError do
55
49
  page.links[0].click
56
- }
57
- assert_raise(Mechanize::RobotsDisallowedError) {
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
- assert_nothing_raised {
66
- page.links[0].click
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
- assert_nothing_raised {
75
- page.links[0].click
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
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class TestSaveFile < Test::Unit::TestCase
3
+ class TestSaveFile < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @agent = Mechanize.new
6
6
  end
data/test/test_scheme.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class SchemeTest < Test::Unit::TestCase
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
- assert_not_nil(link)
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 < Test::Unit::TestCase
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
- assert_not_nil(option_list)
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
@@ -1,5 +1,5 @@
1
1
  require "helper"
2
- class SelectAllTest < Test::Unit::TestCase
2
+ class SelectAllTest < MiniTest::Unit::TestCase
3
3
  def setup
4
4
  @agent = Mechanize.new
5
5
  @page = @agent.get("http://localhost/form_select_all.html")
@@ -1,5 +1,5 @@
1
1
  require "helper"
2
- class SelectNoneTest < Test::Unit::TestCase
2
+ class SelectNoneTest < MiniTest::Unit::TestCase
3
3
  def setup
4
4
  @agent = Mechanize.new
5
5
  @page = @agent.get("http://localhost/form_select_none.html")
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class SelectNoOptionsTest < Test::Unit::TestCase
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
- assert_not_nil(@form.field('list'))
12
- assert_nil(@form.list)
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
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class TestSetFields < Test::Unit::TestCase
3
+ class TestSetFields < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @agent = Mechanize.new
6
6
  @page = @agent.get("http://localhost/form_set_fields.html")
@@ -1,6 +1,6 @@
1
1
  require "helper"
2
2
 
3
- class SSLServerTest < Test::Unit::TestCase
3
+ class SSLServerTest < MiniTest::Unit::TestCase
4
4
  def setup
5
5
  @agent = Mechanize.new
6
6
  end
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: 3
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- version: "2.0"
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-27 00:00:00 Z
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: hoe
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: *id005
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
- .�q�ʼ�aַ�G�/��XbXGo��u �!1��Q`8��5�L��Po�,u?�Q�wp���3�)k� �Y� ���S���g[U$����f \ٷ��-C�az->�ro�Rׄ�猋�Z*L<��@I�p�J|Fd"����pM:g�oQ�?�
2
- ��9����'�E�Vd���4�/=��}[<��!a���B96@�cBW  ����{LO|��`�����
1
+ }=x1�1+h��5�lP0�����Jz�8��+˘�1�$�箇���ՙ_��wm\u'���*�=��:�����zV7N��/����I��DC���L���