davidtrogers-webrat 0.4.4.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. data/.gitignore +3 -1
  2. data/Gemfile +19 -0
  3. data/History.txt +99 -9
  4. data/Rakefile +141 -207
  5. data/Thorfile +118 -0
  6. data/lib/webrat.rb +10 -23
  7. data/lib/webrat/{mechanize.rb → adapters/mechanize.rb} +6 -2
  8. data/lib/webrat/adapters/merb.rb +11 -0
  9. data/lib/webrat/adapters/rack.rb +25 -0
  10. data/lib/webrat/{rails.rb → adapters/rails.rb} +5 -37
  11. data/lib/webrat/adapters/sinatra.rb +9 -0
  12. data/lib/webrat/core.rb +0 -1
  13. data/lib/webrat/core/configuration.rb +22 -18
  14. data/lib/webrat/core/elements/area.rb +2 -2
  15. data/lib/webrat/core/elements/element.rb +3 -3
  16. data/lib/webrat/core/elements/field.rb +113 -31
  17. data/lib/webrat/core/elements/form.rb +4 -4
  18. data/lib/webrat/core/elements/label.rb +4 -4
  19. data/lib/webrat/core/elements/link.rb +8 -7
  20. data/lib/webrat/core/elements/select_option.rb +15 -2
  21. data/lib/webrat/core/locators.rb +1 -1
  22. data/lib/webrat/core/locators/area_locator.rb +3 -3
  23. data/lib/webrat/core/locators/button_locator.rb +6 -6
  24. data/lib/webrat/core/locators/field_by_id_locator.rb +3 -3
  25. data/lib/webrat/core/locators/field_labeled_locator.rb +2 -2
  26. data/lib/webrat/core/locators/field_named_locator.rb +3 -3
  27. data/lib/webrat/core/locators/form_locator.rb +1 -1
  28. data/lib/webrat/core/locators/label_locator.rb +2 -2
  29. data/lib/webrat/core/locators/link_locator.rb +16 -8
  30. data/lib/webrat/core/locators/select_option_locator.rb +5 -5
  31. data/lib/webrat/core/logging.rb +4 -5
  32. data/lib/webrat/core/matchers/have_content.rb +3 -8
  33. data/lib/webrat/core/matchers/have_xpath.rb +3 -28
  34. data/lib/webrat/core/methods.rb +5 -4
  35. data/lib/webrat/core/mime.rb +11 -22
  36. data/lib/webrat/core/save_and_open_page.rb +7 -29
  37. data/lib/webrat/core/scope.rb +17 -2
  38. data/lib/webrat/core/session.rb +31 -19
  39. data/lib/webrat/core/xml.rb +41 -84
  40. data/lib/webrat/integrations/merb.rb +10 -0
  41. data/lib/webrat/integrations/rails.rb +25 -0
  42. data/lib/webrat/integrations/rspec-rails.rb +11 -0
  43. data/lib/webrat/integrations/selenium.rb +11 -0
  44. data/lib/webrat/rspec-rails.rb +2 -13
  45. data/lib/webrat/selenium.rb +0 -11
  46. data/lib/webrat/selenium/application_server_factory.rb +40 -0
  47. data/lib/webrat/selenium/application_servers.rb +5 -0
  48. data/lib/webrat/selenium/application_servers/base.rb +46 -0
  49. data/lib/webrat/selenium/application_servers/external.rb +26 -0
  50. data/lib/webrat/selenium/application_servers/merb.rb +50 -0
  51. data/lib/webrat/selenium/application_servers/rails.rb +44 -0
  52. data/lib/webrat/selenium/application_servers/sinatra.rb +37 -0
  53. data/lib/webrat/selenium/location_strategy_javascript/label.js +30 -3
  54. data/lib/webrat/selenium/location_strategy_javascript/webrat.js +1 -0
  55. data/lib/webrat/selenium/location_strategy_javascript/webratlink.js +24 -4
  56. data/lib/webrat/selenium/matchers/have_content.rb +22 -10
  57. data/lib/webrat/selenium/matchers/have_selector.rb +8 -0
  58. data/lib/webrat/selenium/matchers/have_xpath.rb +8 -0
  59. data/lib/webrat/selenium/selenium_rc_server.rb +8 -6
  60. data/lib/webrat/selenium/selenium_session.rb +43 -14
  61. data/lib/webrat/selenium/silence_stream.rb +2 -2
  62. data/spec/fakes/{test_session.rb → test_adapter.rb} +4 -5
  63. data/spec/integration/mechanize/Rakefile +7 -0
  64. data/spec/integration/mechanize/config.ru +2 -0
  65. data/spec/integration/mechanize/sample_app.rb +20 -0
  66. data/spec/integration/mechanize/spec/mechanize_spec.rb +22 -0
  67. data/spec/integration/mechanize/spec/spec_helper.rb +29 -0
  68. data/spec/integration/merb/app/controllers/testing.rb +9 -0
  69. data/spec/integration/merb/app/views/testing/upload.html.erb +9 -0
  70. data/spec/integration/merb/config/router.rb +1 -0
  71. data/spec/integration/merb/spec/spec_helper.rb +2 -0
  72. data/spec/integration/merb/spec/webrat_spec.rb +7 -0
  73. data/spec/integration/rack/app.rb +89 -0
  74. data/spec/integration/rack/test/helper.rb +21 -0
  75. data/spec/integration/rack/test/webrat_rack_test.rb +57 -51
  76. data/spec/integration/rails/app/controllers/{application.rb → application_controller.rb} +0 -0
  77. data/spec/integration/rails/app/controllers/webrat_controller.rb +16 -9
  78. data/spec/integration/rails/app/views/buttons/show.html.erb +0 -2
  79. data/spec/integration/rails/app/views/links/show.html.erb +2 -1
  80. data/spec/integration/rails/app/views/webrat/buttons.html.erb +0 -2
  81. data/spec/integration/rails/app/views/webrat/within.html.erb +3 -0
  82. data/spec/integration/rails/config/environment.rb +1 -1
  83. data/spec/integration/rails/config/routes.rb +2 -0
  84. data/spec/integration/rails/test/integration/button_click_test.rb +12 -26
  85. data/spec/integration/rails/test/integration/fill_in_test.rb +1 -1
  86. data/spec/integration/rails/test/integration/link_click_test.rb +8 -2
  87. data/spec/integration/rails/test/integration/webrat_test.rb +53 -5
  88. data/spec/integration/rails/test/test_helper.rb +7 -5
  89. data/spec/integration/sinatra/test/test_helper.rb +3 -2
  90. data/spec/private/core/configuration_spec.rb +8 -27
  91. data/spec/private/core/field_spec.rb +14 -16
  92. data/spec/private/core/link_spec.rb +1 -1
  93. data/spec/private/core/session_spec.rb +23 -26
  94. data/spec/private/mechanize/{mechanize_session_spec.rb → mechanize_adapter_spec.rb} +4 -12
  95. data/spec/private/nokogiri_spec.rb +2 -2
  96. data/spec/private/rails/{rails_session_spec.rb → rails_adapter_spec.rb} +11 -42
  97. data/spec/private/selenium/application_servers/rails_spec.rb +26 -0
  98. data/spec/public/basic_auth_spec.rb +13 -2
  99. data/spec/public/click_button_spec.rb +10 -12
  100. data/spec/public/click_link_spec.rb +21 -0
  101. data/spec/public/fill_in_spec.rb +15 -0
  102. data/spec/public/matchers/contain_spec.rb +12 -19
  103. data/spec/public/matchers/have_selector_spec.rb +6 -2
  104. data/spec/public/matchers/have_xpath_spec.rb +3 -3
  105. data/spec/public/save_and_open_spec.rb +15 -17
  106. data/spec/public/select_spec.rb +232 -26
  107. data/spec/public/selenium/application_server_factory_spec.rb +49 -0
  108. data/spec/public/selenium/application_servers/external_spec.rb +12 -0
  109. data/spec/public/selenium/selenium_session_spec.rb +37 -0
  110. data/spec/spec_helper.rb +5 -1
  111. data/vendor/selenium-server.jar +0 -0
  112. metadata +119 -69
  113. data/.dotest/0001 +0 -34
  114. data/.dotest/0002 +0 -34
  115. data/.dotest/binary +0 -1
  116. data/.dotest/final-commit +0 -1
  117. data/.dotest/head-name +0 -1
  118. data/.dotest/info +0 -5
  119. data/.dotest/keep +0 -1
  120. data/.dotest/last +0 -1
  121. data/.dotest/msg +0 -0
  122. data/.dotest/msg-clean +0 -0
  123. data/.dotest/next +0 -1
  124. data/.dotest/onto +0 -1
  125. data/.dotest/orig-head +0 -1
  126. data/.dotest/patch +0 -29
  127. data/.dotest/sign +0 -1
  128. data/.dotest/utf8 +0 -1
  129. data/.dotest/whitespace +0 -1
  130. data/VERSION +0 -1
  131. data/lib/webrat/core/xml/hpricot.rb +0 -19
  132. data/lib/webrat/core/xml/nokogiri.rb +0 -76
  133. data/lib/webrat/core/xml/rexml.rb +0 -24
  134. data/lib/webrat/merb_session.rb +0 -65
  135. data/lib/webrat/rack.rb +0 -24
  136. data/lib/webrat/rack_test.rb +0 -32
  137. data/lib/webrat/selenium/application_server.rb +0 -73
  138. data/lib/webrat/selenium/merb_application_server.rb +0 -48
  139. data/lib/webrat/selenium/rails_application_server.rb +0 -42
  140. data/lib/webrat/selenium/sinatra_application_server.rb +0 -35
  141. data/lib/webrat/sinatra.rb +0 -44
  142. data/spec/integration/rack/rack_app.rb +0 -16
  143. data/spec/integration/rack/test/test_helper.rb +0 -20
  144. data/spec/private/core/logging_spec.rb +0 -10
  145. data/spec/private/merb/merb_session_spec.rb +0 -42
@@ -1,11 +1,9 @@
1
1
  <h1 id='form_title' class='form title'>Webrat Buttons Form</h1>
2
2
 
3
3
  <% form_tag "/buttons" do %>
4
- <input type="button" id="input_button_id" value="input_button_value" />
5
4
  <input type="submit" id="input_submit_id" value="input_submit_value" />
6
5
  <input type="image" id="input_image_id" value="input_image_value" alt="input_image_alt" src="" />
7
6
 
8
- <button type="button" id="button_button_id" value="button_button_value">button_button_text</button>
9
7
  <button type="submit" id="button_submit_id" value="button_submit_value">button_submit_text</button>
10
8
  <button type="image" id="button_image_id" value="button_image_value">button_image_text</button>
11
9
  <% end %>
@@ -1,4 +1,5 @@
1
1
  <h1>Webrat Links Page</h1>
2
2
  <a href="/links?value=LinkByText">LinkByText</a><br />
3
3
  <a href="/links?value=link_by_id" id="link_by_id">id</a><br />
4
- <a href="/links?value=LinkByTitle" title="LinkByTitle">title</a>
4
+ <a href="/links?value=LinkByTitle" title="LinkByTitle">title</a><br />
5
+ <a href="/links?value=link_with_parens">Link With (parens)</a><br />
@@ -1,11 +1,9 @@
1
1
  <h1 id='form_title' class='form title'>Webrat Buttons Form</h1>
2
2
 
3
3
  <% form_tag submit_path do %>
4
- <input type="button" id="input_button_id" value="input_button_value">
5
4
  <input type="submit" id="input_submit_id" value="input_submit_value">
6
5
  <input type="image" id="input_image_id" value="input_image_value" alt="input_image_alt" src="">
7
6
 
8
- <button type="button" id="button_button_id" value="button_button_value">button_button_text</button>
9
7
  <button type="submit" id="button_submit_id" value="button_submit_value">button_submit_text</button>
10
8
  <button type="image" id="button_image_id" value="button_image_value">button_image_text</button>
11
9
  <% end %>
@@ -0,0 +1,3 @@
1
+ <div id="new_object">
2
+ <a href="/">Edit Object</a>
3
+ </div>
@@ -1,4 +1,4 @@
1
- RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
1
+ # RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
2
2
 
3
3
  require File.join(File.dirname(__FILE__), 'boot')
4
4
 
@@ -7,10 +7,12 @@ ActionController::Routing::Routes.draw do |map|
7
7
  webrat.internal_redirect "/internal_redirect", :action => "internal_redirect"
8
8
  webrat.external_redirect "/external_redirect", :action => "external_redirect"
9
9
  webrat.infinite_redirect "/infinite_redirect", :action => "infinite_redirect"
10
+ webrat.host_redirect "/host_redirect", :action => "host_redirect"
10
11
 
11
12
  webrat.before_redirect_form "/before_redirect_form", :action => "before_redirect_form"
12
13
  webrat.redirect_to_show_params "/redirect_to_show_params", :action => "redirect_to_show_params"
13
14
  webrat.show_params "/show_params", :action => "show_params"
15
+ webrat.within "/within", :action => "within"
14
16
 
15
17
  webrat.root :action => "form"
16
18
  end
@@ -1,80 +1,66 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class ButtonClickTest < ActionController::IntegrationTest
4
- # <button type="button" ...>
5
- test "should click button with type button by id" do
6
- visit buttons_path
7
- click_button "button_button_id"
8
- end
9
- test "should click button with type button by value" do
10
- visit buttons_path
11
- click_button "button_button_value"
12
- end
13
- test "should click button with type button by html" do
14
- visit buttons_path
15
- click_button "button_button_text"
16
- end
17
-
18
4
  # <button type="submit" ...>
19
5
  test "should click button with type submit by id" do
20
6
  visit buttons_path
21
7
  click_button "button_submit_id"
8
+ assert_contain "success"
22
9
  end
23
10
  test "should click button with type submit by value" do
24
11
  visit buttons_path
25
12
  click_button "button_submit_value"
13
+ assert_contain "success"
26
14
  end
27
15
  test "should click button with type submit by html" do
28
16
  visit buttons_path
29
17
  click_button "button_submit_text"
18
+ assert_contain "success"
30
19
  end
31
20
 
32
21
  # <button type="image" ...>
33
22
  test "should click button with type image by id" do
34
23
  visit buttons_path
35
24
  click_button "button_image_id"
25
+ assert_contain "success"
36
26
  end
37
27
  test "should click button with type image by value" do
38
28
  visit buttons_path
39
29
  click_button "button_image_value"
30
+ assert_contain "success"
40
31
  end
41
32
  test "should click button with type image by html" do
42
33
  visit buttons_path
43
34
  click_button "button_image_text"
44
- end
45
-
46
- # <input type="button" ...>
47
- test "should click image with type button by id" do
48
- visit buttons_path
49
- click_button "input_button_id"
50
- end
51
- test "should click input with type button by value" do
52
- visit buttons_path
53
- click_button "input_button_value"
35
+ assert_contain "success"
54
36
  end
55
37
 
56
38
  # <input type="submit" ...>
57
39
  test "should click input with type submit by id" do
58
40
  visit buttons_path
59
41
  click_button "input_submit_id"
42
+ assert_contain "success"
60
43
  end
61
44
  test "should click input with type submit by value" do
62
45
  visit buttons_path
63
46
  click_button "input_submit_value"
47
+ assert_contain "success"
64
48
  end
65
49
 
66
50
  # <input type="image" ...>
67
51
  test "should click input with type image by id" do
68
52
  visit buttons_path
69
53
  click_button "input_image_id"
54
+ assert_contain "success"
70
55
  end
71
56
  test "should click input with type image by value" do
72
57
  visit buttons_path
73
58
  click_button "input_image_value"
59
+ assert_contain "success"
74
60
  end
75
61
  test "should click input with type image by alt" do
76
62
  visit buttons_path
77
63
  click_button "input_image_alt"
64
+ assert_contain "success"
78
65
  end
79
-
80
- end
66
+ end
@@ -21,4 +21,4 @@ class FillInTest < ActionController::IntegrationTest
21
21
  visit fields_path
22
22
  fill_in "[Field]:", :with => "value"
23
23
  end
24
- end
24
+ end
@@ -12,10 +12,16 @@ class LinkClickTest < ActionController::IntegrationTest
12
12
  click_link "link_by_id"
13
13
  assert_contain("Link:link_by_id")
14
14
  end
15
-
15
+
16
16
  test "should click link by title" do
17
17
  visit links_path
18
18
  click_link "LinkByTitle"
19
19
  assert_contain("Link:LinkByTitle")
20
20
  end
21
- end
21
+
22
+ test "should be able to click links with non letter characters" do
23
+ visit links_path
24
+ click_link "Link With (parens)"
25
+ assert_contain("Link:link_with_parens")
26
+ end
27
+ end
@@ -22,11 +22,14 @@ class WebratTest < ActionController::IntegrationTest
22
22
  check "TOS"
23
23
  select "January"
24
24
  click_button "Test"
25
+ assert_contain "OK"
25
26
  end
26
27
 
27
28
  test "should check the value of a field" do
28
- visit "/"
29
- assert field_labeled("Prefilled").value, "text"
29
+ webrat.simulate do
30
+ visit "/"
31
+ assert field_labeled("Prefilled").value, "text"
32
+ end
30
33
  end
31
34
 
32
35
  test "should not carry params through redirects" do
@@ -34,19 +37,47 @@ class WebratTest < ActionController::IntegrationTest
34
37
  fill_in "Text field", :with => "value"
35
38
  click_button
36
39
 
40
+ automate do
41
+ selenium.wait_for_page_to_load
42
+ end
37
43
  assert response.body !~ /value/
38
44
  assert response.body =~ /custom_param/
39
45
  end
40
46
 
41
47
  test "should follow internal redirects" do
42
48
  visit internal_redirect_path
43
- assert !response.redirect?
49
+ webrat.simulate do
50
+ assert !response.redirect?
51
+ end
44
52
  assert response.body.include?("OK")
45
53
  end
46
54
 
47
55
  test "should not follow external redirects" do
48
- visit external_redirect_path
49
- assert response.redirect?
56
+ webrat.simulate do
57
+ visit external_redirect_path
58
+ assert response.redirect?
59
+ end
60
+ end
61
+
62
+ test "should recognize the host header to follow redirects properly" do
63
+ webrat.simulate do
64
+ header "Host", "foo.bar"
65
+ visit host_redirect_path
66
+ assert !response.redirect?
67
+ assert response.body.include?("OK")
68
+ end
69
+ end
70
+
71
+ test "should click link by text" do
72
+ visit internal_redirect_path
73
+ click_link "Test Link Text"
74
+ assert_contain("Webrat Form")
75
+ end
76
+
77
+ test "should click link by id" do
78
+ visit internal_redirect_path
79
+ click_link "link_id"
80
+ assert_contain("Webrat Form")
50
81
  end
51
82
 
52
83
  test "should be able to assert xpath" do
@@ -59,6 +90,23 @@ class WebratTest < ActionController::IntegrationTest
59
90
  assert_have_selector "h1"
60
91
  end
61
92
 
93
+ test "should accept an Object argument to #within and translate using dom_id" do
94
+ webrat.simulate do
95
+ visit within_path
96
+
97
+ object = Object.new
98
+ def object.id
99
+ nil
100
+ end
101
+
102
+ within(object) do
103
+ click_link "Edit Object"
104
+ end
105
+
106
+ assert_contain "Webrat Form"
107
+ end
108
+ end
109
+
62
110
  # Firefox detects and prevents infinite redirects under Selenium
63
111
  unless ENV['WEBRAT_INTEGRATION_MODE'] == 'selenium'
64
112
  test "should detect infinite redirects" do
@@ -2,15 +2,17 @@ ENV["RAILS_ENV"] = "test"
2
2
  require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
3
  require 'test_help'
4
4
 
5
- begin
6
- require "redgreen"
7
- rescue MissingSourceFile
8
- end
5
+ # begin
6
+ # require "redgreen"
7
+ # rescue MissingSourceFile
8
+ # end
9
9
 
10
- require File.dirname(__FILE__) + "/../../../../lib/webrat"
10
+ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
11
+ require "webrat"
11
12
 
12
13
  Webrat.configure do |config|
13
14
  config.mode = ENV['WEBRAT_INTEGRATION_MODE'].to_sym
15
+ config.selenium_browser_key = '*safari'
14
16
  end
15
17
 
16
18
  ActionController::Base.class_eval do
@@ -1,8 +1,9 @@
1
1
  require "rubygems"
2
2
  require "test/unit"
3
- require "redgreen"
3
+ # require "redgreen"
4
4
 
5
- require File.dirname(__FILE__) + "/../../../../lib/webrat"
5
+ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
6
+ require "webrat"
6
7
 
7
8
  Webrat.configure do |config|
8
9
  config.mode = :sinatra
@@ -1,16 +1,15 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
2
 
3
3
  describe Webrat::Configuration do
4
- predicate_matchers[:parse_with_nokogiri] = :parse_with_nokogiri?
5
- predicate_matchers[:open_error_files] = :open_error_files?
6
4
 
7
- it "should have a mode" do
8
- Webrat.configuration.should respond_to(:mode)
5
+ Spec::Matchers.define :open_error_files do
6
+ match do |config|
7
+ config.open_error_files?
8
+ end
9
9
  end
10
10
 
11
- it "should use Nokogiri as the parser by default" do
12
- config = Webrat::Configuration.new
13
- config.should parse_with_nokogiri
11
+ it "should have a mode" do
12
+ Webrat.configuration.should respond_to(:mode)
14
13
  end
15
14
 
16
15
  it "should open error files by default" do
@@ -46,24 +45,6 @@ describe Webrat::Configuration do
46
45
  config.selenium_server_port.should == 1234
47
46
  end
48
47
 
49
- [:rails,
50
- :selenium,
51
- :rack,
52
- :sinatra,
53
- :mechanize].each do |mode|
54
- it "should require correct lib when in #{mode} mode" do
55
- config = Webrat::Configuration.new
56
- config.should_receive(:require).with("webrat/#{mode}")
57
- config.mode = mode
58
- end
59
- end
60
-
61
- it "should require merb_session when in merb mode" do
62
- config = Webrat::Configuration.new
63
- config.should_receive(:require).with("webrat/merb_session")
64
- config.mode = :merb
65
- end
66
-
67
48
  describe "Selenium" do
68
49
  before :each do
69
50
  @config = Webrat::Configuration.new
@@ -92,11 +73,11 @@ describe Webrat::Configuration do
92
73
  it 'should default selenium browser key to *firefox' do
93
74
  @config.selenium_browser_key.should == '*firefox'
94
75
  end
95
-
76
+
96
77
  it 'should default selenium browser startup timeout to 5 seconds' do
97
78
  @config.selenium_browser_startup_timeout.should == 5
98
79
  end
99
-
80
+
100
81
  it 'should allow overriding of the browser startup timeout' do
101
82
  @config.selenium_browser_startup_timeout = 10
102
83
  @config.selenium_browser_startup_timeout.should == 10
@@ -2,18 +2,16 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
2
 
3
3
  module Webrat
4
4
  describe Field do
5
- unless Webrat.on_java?
6
- it "should have nice inspect output" do
7
- html = <<-HTML
8
- <html>
9
- <input type='checkbox' checked='checked' />
10
- </html>
11
- HTML
5
+ it "should have nice inspect output" do
6
+ html = <<-HTML
7
+ <html>
8
+ <input type='checkbox' checked='checked' />
9
+ </html>
10
+ HTML
12
11
 
13
- element = Webrat::XML.css_search(Webrat::XML.document(html), "input").first
14
- checkbox = CheckboxField.new(nil, element)
15
- checkbox.inspect.should =~ /#<Webrat::CheckboxField @element=<input type=['"]checkbox['"] checked(=['"]checked['"])?\/?>>/
16
- end
12
+ element = Webrat::XML.document(html).css("input").first
13
+ checkbox = CheckboxField.new(nil, element)
14
+ checkbox.inspect.should =~ /^#<Webrat::CheckboxField @element=/
17
15
  end
18
16
  end
19
17
 
@@ -25,7 +23,7 @@ module Webrat
25
23
  </html>
26
24
  HTML
27
25
 
28
- element = Webrat::XML.css_search(Webrat::XML.document(html), "input").first
26
+ element = Webrat::XML.document(html).css("input").first
29
27
  checkbox = CheckboxField.new(nil, element)
30
28
  checkbox.should be_checked
31
29
  end
@@ -37,7 +35,7 @@ module Webrat
37
35
  </html>
38
36
  HTML
39
37
 
40
- element = Webrat::XML.css_search(Webrat::XML.document(html), "input").first
38
+ element = Webrat::XML.document(html).css("input").first
41
39
  checkbox = CheckboxField.new(nil, element)
42
40
  checkbox.should_not be_checked
43
41
  end
@@ -51,7 +49,7 @@ module Webrat
51
49
  </html>
52
50
  HTML
53
51
 
54
- element = Webrat::XML.css_search(Webrat::XML.document(html), "input").first
52
+ element = Webrat::XML.document(html).css("input").first
55
53
  radio_button = RadioField.new(nil, element)
56
54
  radio_button.should be_checked
57
55
  end
@@ -61,7 +59,7 @@ module Webrat
61
59
  <html><input type='radio' /></html>
62
60
  HTML
63
61
 
64
- element = Webrat::XML.css_search(Webrat::XML.document(html), "input").first
62
+ element = Webrat::XML.document(html).css("input").first
65
63
  radio_button = RadioField.new(nil, element)
66
64
  radio_button.should_not be_checked
67
65
  end
@@ -77,7 +75,7 @@ module Webrat
77
75
  </html>
78
76
  HTML
79
77
 
80
- element = Webrat::XML.css_search(Webrat::XML.document(html), 'input').first
78
+ element = Webrat::XML.document(html).css('input').first
81
79
  text_field = TextField.new(nil, element)
82
80
  text_field.to_param.should == { 'email' => 'user@example.com' }
83
81
  end
@@ -4,7 +4,7 @@ describe Webrat::Link do
4
4
  # include Webrat::Link
5
5
 
6
6
  before do
7
- webrat_session = mock(Webrat::TestSession)
7
+ webrat_session = mock(Webrat::TestAdapter)
8
8
  @link_text_with_nbsp = 'Link' + [0xA0].pack("U") + 'Text'
9
9
  end
10
10