capybara 1.1.4 → 2.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/History.txt +100 -0
  2. data/License.txt +22 -0
  3. data/README.md +829 -0
  4. data/lib/capybara.rb +124 -6
  5. data/lib/capybara/cucumber.rb +2 -5
  6. data/lib/capybara/driver/base.rb +5 -5
  7. data/lib/capybara/driver/node.rb +2 -2
  8. data/lib/capybara/dsl.rb +3 -121
  9. data/lib/capybara/node/actions.rb +12 -28
  10. data/lib/capybara/node/base.rb +5 -13
  11. data/lib/capybara/node/element.rb +21 -21
  12. data/lib/capybara/node/finders.rb +27 -89
  13. data/lib/capybara/node/matchers.rb +107 -69
  14. data/lib/capybara/node/simple.rb +11 -13
  15. data/lib/capybara/query.rb +78 -0
  16. data/lib/capybara/rack_test/browser.rb +16 -27
  17. data/lib/capybara/rack_test/driver.rb +11 -1
  18. data/lib/capybara/rack_test/node.rb +17 -1
  19. data/lib/capybara/result.rb +84 -0
  20. data/lib/capybara/rspec/matchers.rb +28 -63
  21. data/lib/capybara/selector.rb +97 -33
  22. data/lib/capybara/selenium/driver.rb +14 -61
  23. data/lib/capybara/selenium/node.rb +6 -15
  24. data/lib/capybara/server.rb +32 -27
  25. data/lib/capybara/session.rb +54 -30
  26. data/lib/capybara/spec/public/jquery-ui.js +791 -0
  27. data/lib/capybara/spec/public/jquery.js +9046 -0
  28. data/lib/capybara/spec/public/test.js +4 -1
  29. data/lib/capybara/spec/session.rb +56 -27
  30. data/lib/capybara/spec/session/all_spec.rb +8 -4
  31. data/lib/capybara/spec/session/attach_file_spec.rb +12 -9
  32. data/lib/capybara/spec/session/check_spec.rb +6 -3
  33. data/lib/capybara/spec/session/choose_spec.rb +4 -1
  34. data/lib/capybara/spec/session/click_button_spec.rb +5 -14
  35. data/lib/capybara/spec/session/click_link_or_button_spec.rb +2 -1
  36. data/lib/capybara/spec/session/click_link_spec.rb +3 -17
  37. data/lib/capybara/spec/session/current_url_spec.rb +77 -9
  38. data/lib/capybara/spec/session/fill_in_spec.rb +8 -18
  39. data/lib/capybara/spec/session/find_spec.rb +19 -46
  40. data/lib/capybara/spec/session/first_spec.rb +2 -34
  41. data/lib/capybara/spec/session/has_css_spec.rb +1 -1
  42. data/lib/capybara/spec/session/has_field_spec.rb +28 -0
  43. data/lib/capybara/spec/session/has_select_spec.rb +84 -31
  44. data/lib/capybara/spec/session/has_table_spec.rb +7 -69
  45. data/lib/capybara/spec/session/has_text_spec.rb +168 -0
  46. data/lib/capybara/spec/session/javascript.rb +65 -81
  47. data/lib/capybara/spec/session/node_spec.rb +115 -0
  48. data/lib/capybara/spec/session/screenshot.rb +29 -0
  49. data/lib/capybara/spec/session/select_spec.rb +12 -12
  50. data/lib/capybara/spec/session/text_spec.rb +9 -4
  51. data/lib/capybara/spec/session/unselect_spec.rb +12 -6
  52. data/lib/capybara/spec/session/visit_spec.rb +76 -0
  53. data/lib/capybara/spec/session/within_frame_spec.rb +33 -0
  54. data/lib/capybara/spec/session/within_spec.rb +47 -58
  55. data/lib/capybara/spec/session/within_window_spec.rb +40 -0
  56. data/lib/capybara/spec/test_app.rb +27 -3
  57. data/lib/capybara/spec/views/form.erb +11 -10
  58. data/lib/capybara/spec/views/host_links.erb +2 -2
  59. data/lib/capybara/spec/views/tables.erb +6 -66
  60. data/lib/capybara/spec/views/with_html.erb +3 -3
  61. data/lib/capybara/spec/views/with_js.erb +11 -8
  62. data/lib/capybara/util/save_and_open_page.rb +4 -3
  63. data/lib/capybara/version.rb +1 -1
  64. data/spec/basic_node_spec.rb +15 -3
  65. data/spec/dsl_spec.rb +12 -10
  66. data/spec/rack_test_spec.rb +152 -0
  67. data/spec/rspec/features_spec.rb +0 -2
  68. data/spec/rspec/matchers_spec.rb +164 -89
  69. data/spec/rspec_spec.rb +0 -2
  70. data/spec/selenium_spec.rb +67 -0
  71. data/spec/server_spec.rb +35 -23
  72. data/spec/spec_helper.rb +18 -2
  73. metadata +30 -30
  74. data/README.rdoc +0 -722
  75. data/lib/capybara/spec/driver.rb +0 -301
  76. data/lib/capybara/spec/session/current_host_spec.rb +0 -68
  77. data/lib/capybara/spec/session/has_content_spec.rb +0 -106
  78. data/lib/capybara/util/timeout.rb +0 -27
  79. data/spec/driver/rack_test_driver_spec.rb +0 -89
  80. data/spec/driver/selenium_driver_spec.rb +0 -37
  81. data/spec/session/rack_test_session_spec.rb +0 -55
  82. data/spec/session/selenium_session_spec.rb +0 -26
  83. data/spec/string_spec.rb +0 -77
  84. data/spec/timeout_spec.rb +0 -28
@@ -27,6 +27,9 @@ $(function() {
27
27
  $('#with_focus_event').focus(function() {
28
28
  $('body').append('<p id="focus_event_triggered">Focus Event triggered</p>');
29
29
  });
30
+ $('#with_change_event').change(function() {
31
+ if($(this).val() == '') $(this).val("Can't be empty");
32
+ });
30
33
  $('#checkbox_with_event').click(function() {
31
34
  $('body').append('<p id="checkbox_event_triggered">Checkbox event triggered</p>');
32
35
  });
@@ -37,7 +40,7 @@ $(function() {
37
40
  });
38
41
  $('#reload-link').click(function() {
39
42
  setTimeout(function() {
40
- $('#reload-me').replaceWith('<div id="reload-me"><em><a>has been reloaded</a></em></div>');
43
+ $('#reload-me').replaceWith('<div id="reload-me"><em><a>RELOADED</a></em></div>');
41
44
  }, 250)
42
45
  });
43
46
  $('#reload-list').click(function() {
@@ -3,30 +3,56 @@ require 'nokogiri'
3
3
 
4
4
  Dir[File.dirname(__FILE__)+'/session/*'].each { |group| require group }
5
5
 
6
+ module Quietly
7
+ def silence_stream(stream)
8
+ old_stream = stream.dup
9
+ stream.reopen(RbConfig::CONFIG['host_os'] =~ /rmswin|mingw/ ? 'NUL:' : '/dev/null')
10
+ stream.sync = true
11
+ yield
12
+ ensure
13
+ stream.reopen(old_stream)
14
+ end
15
+
16
+ def quietly
17
+ silence_stream(STDOUT) do
18
+ silence_stream(STDERR) do
19
+ yield
20
+ end
21
+ end
22
+ end
23
+ end
24
+
6
25
  shared_examples_for "session" do
7
26
  def extract_results(session)
8
- YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text
27
+ YAML.load Nokogiri::HTML(session.body).xpath("//pre[@id='results']").first.text.lstrip
9
28
  end
10
29
 
30
+ include Quietly
31
+
11
32
  after do
12
33
  @session.reset_session!
13
34
  end
14
35
 
15
- describe '#visit' do
16
- it "should fetch a response from the driver" do
17
- @session.visit('/')
18
- @session.body.should include('Hello world!')
19
- @session.visit('/foo')
20
- @session.body.should include('Another World')
21
- end
22
- end
23
-
24
36
  describe '#body' do
25
37
  it "should return the unmodified page body" do
26
38
  @session.visit('/')
27
39
  @session.body.should include('Hello world!')
28
40
  end
29
- end
41
+
42
+ if "".respond_to?(:encoding)
43
+ context "encoding of response between ascii and utf8" do
44
+ it "should be valid with html entities" do
45
+ @session.visit('/with_html_entities')
46
+ lambda { @session.body.encode!("UTF-8") }.should_not raise_error
47
+ end
48
+
49
+ it "should be valid without html entities" do
50
+ @session.visit('/with_html')
51
+ lambda { @session.body.encode!("UTF-8") }.should_not raise_error
52
+ end
53
+ end
54
+ end
55
+ end
30
56
 
31
57
  describe '#html' do
32
58
  it "should return the unmodified page body" do
@@ -34,7 +60,7 @@ shared_examples_for "session" do
34
60
  # method(:html) == method(:body) because these shared examples get run
35
61
  # against the DSL, which uses forwarding methods. So we test behavior.
36
62
  @session.visit('/')
37
- @session.body.should include('Hello world!')
63
+ @session.html.should include('Hello world!')
38
64
  end
39
65
  end
40
66
 
@@ -56,19 +82,15 @@ shared_examples_for "session" do
56
82
  @session.body.should_not include('test_cookie')
57
83
  end
58
84
 
59
- it "resets current host" do
60
- @session.visit('http://capybara-testapp.heroku.com')
61
- @session.current_host.should == 'http://capybara-testapp.heroku.com'
85
+ it "resets current url, host, path" do
86
+ @session.visit '/foo'
87
+ @session.current_url.should_not be_empty
88
+ @session.current_host.should_not be_empty
89
+ @session.current_path.should == '/foo'
62
90
 
63
91
  @session.reset_session!
92
+ [nil, '', 'about:blank'].should include @session.current_url
64
93
  @session.current_host.should be_nil
65
- end
66
-
67
- it "resets current path" do
68
- @session.visit('/with_html')
69
- @session.current_path.should == '/with_html'
70
-
71
- @session.reset_session!
72
94
  @session.current_path.should be_nil
73
95
  end
74
96
 
@@ -81,8 +103,19 @@ shared_examples_for "session" do
81
103
  @session.body.should_not include('This is a test')
82
104
  @session.should have_no_selector('.//h1')
83
105
  end
106
+
107
+ it "raises any errors caught inside the server" do
108
+ expect do
109
+ quietly { @session.visit("/error") }
110
+ @session.reset_session!
111
+ end.to raise_error(TestApp::TestAppError)
112
+ @session.visit("/")
113
+ @session.current_path.should == "/"
114
+ end
84
115
  end
85
116
 
117
+ it_should_behave_like "node"
118
+ it_should_behave_like "visit"
86
119
  it_should_behave_like "all"
87
120
  it_should_behave_like "first"
88
121
  it_should_behave_like "attach_file"
@@ -97,8 +130,7 @@ shared_examples_for "session" do
97
130
  it_should_behave_like "find_link"
98
131
  it_should_behave_like "find_by_id"
99
132
  it_should_behave_like "find"
100
- it_should_behave_like "has_content"
101
- it_should_behave_like "has_css"
133
+ it_should_behave_like "has_text"
102
134
  it_should_behave_like "has_css"
103
135
  it_should_behave_like "has_selector"
104
136
  it_should_behave_like "has_xpath"
@@ -113,7 +145,6 @@ shared_examples_for "session" do
113
145
  it_should_behave_like "unselect"
114
146
  it_should_behave_like "within"
115
147
  it_should_behave_like "current_url"
116
- it_should_behave_like "current_host"
117
148
 
118
149
  it "should encode complex field names, like array[][value]" do
119
150
  @session.visit('/form')
@@ -139,10 +170,8 @@ shared_examples_for "session" do
139
170
  addresses[1]["city"].should == 'Mikolaiv'
140
171
  addresses[1]["country"].should == 'Ukraine'
141
172
  end
142
-
143
173
  end
144
174
 
145
-
146
175
  describe Capybara::Session do
147
176
  context 'with non-existant driver' do
148
177
  it "should raise an error" do
@@ -21,6 +21,10 @@ shared_examples_for "all" do
21
21
  @result.should include('Smith', 'John', 'John Smith')
22
22
  end
23
23
 
24
+ it "should raise an error when given invalid options" do
25
+ expect { @session.all('//p', :schmoo => "foo") }.to raise_error(ArgumentError)
26
+ end
27
+
24
28
  context "with css selectors" do
25
29
  it "should find all elements using the given selector" do
26
30
  @session.all(:css, 'h1').first.text.should == 'This is a test'
@@ -51,15 +55,15 @@ shared_examples_for "all" do
51
55
  context "with visible filter" do
52
56
  after { Capybara.ignore_hidden_elements = false }
53
57
  it "should only find visible nodes" do
54
- @session.all("//a[@title='awesome title']").should have(2).elements
55
- @session.all("//a[@title='awesome title']", :visible => true).should have(1).elements
58
+ @session.all(:css, "a.simple").should have(2).elements
59
+ @session.all(:css, "a.simple", :visible => true).should have(1).elements
56
60
  Capybara.ignore_hidden_elements = true
57
- @session.all("//a[@title='awesome title']").should have(1).elements
61
+ @session.all(:css, "a.simple").should have(1).elements
58
62
  end
59
63
 
60
64
  it "should only find invisible nodes" do
61
65
  Capybara.ignore_hidden_elements = true
62
- @session.all("//a[@title='awesome title']", :visible => false).should have(2).elements
66
+ @session.all(:css, "a.simple", :visible => false).should have(2).elements
63
67
  end
64
68
  end
65
69
 
@@ -24,30 +24,30 @@ shared_examples_for "attach_file" do
24
24
  context "with multipart form" do
25
25
  it "should set a file path by id" do
26
26
  @session.attach_file "form_document", @test_file_path
27
- @session.click_button('Upload')
27
+ @session.click_button('Upload Single')
28
28
  @session.body.should include(File.read(@test_file_path))
29
29
  end
30
30
 
31
31
  it "should set a file path by label" do
32
- @session.attach_file "Document", @test_file_path
33
- @session.click_button('Upload')
32
+ @session.attach_file "Single Document", @test_file_path
33
+ @session.click_button('Upload Single')
34
34
  @session.body.should include(File.read(@test_file_path))
35
35
  end
36
36
 
37
37
  it "should not break if no file is submitted" do
38
- @session.click_button('Upload')
38
+ @session.click_button('Upload Single')
39
39
  @session.body.should include('No file uploaded')
40
40
  end
41
41
 
42
42
  it "should send content type text/plain when uploading a text file" do
43
- @session.attach_file "Document", @test_file_path
44
- @session.click_button 'Upload'
43
+ @session.attach_file "Single Document", @test_file_path
44
+ @session.click_button 'Upload Single'
45
45
  @session.body.should include('text/plain')
46
46
  end
47
47
 
48
48
  it "should send content type image/jpeg when uploading an image" do
49
- @session.attach_file "Document", @test_jpg_file_path
50
- @session.click_button 'Upload'
49
+ @session.attach_file "Single Document", @test_jpg_file_path
50
+ @session.click_button 'Upload Single'
51
51
  @session.body.should include('image/jpeg')
52
52
  end
53
53
 
@@ -60,7 +60,10 @@ shared_examples_for "attach_file" do
60
60
 
61
61
  context "with a locator that doesn't exist" do
62
62
  it "should raise an error" do
63
- running { @session.attach_file('does not exist', @test_file_path) }.should raise_error(Capybara::ElementNotFound)
63
+ msg = "Unable to find file field \"does not exist\""
64
+ running do
65
+ @session.attach_file('does not exist', @test_file_path)
66
+ end.should raise_error(Capybara::ElementNotFound, msg)
64
67
  end
65
68
  end
66
69
 
@@ -4,13 +4,13 @@ shared_examples_for "check" do
4
4
  before do
5
5
  @session.visit('/form')
6
6
  end
7
-
7
+
8
8
  describe "'checked' attribute" do
9
9
  it "should be true if checked" do
10
10
  @session.check("Terms of Use")
11
11
  @session.find(:xpath, "//input[@id='form_terms_of_use']")['checked'].should be_true
12
12
  end
13
-
13
+
14
14
  it "should be false if unchecked" do
15
15
  @session.find(:xpath, "//input[@id='form_terms_of_use']")['checked'].should be_false
16
16
  end
@@ -58,7 +58,10 @@ shared_examples_for "check" do
58
58
 
59
59
  context "with a locator that doesn't exist" do
60
60
  it "should raise an error" do
61
- running { @session.check('does not exist') }.should raise_error(Capybara::ElementNotFound)
61
+ msg = "Unable to find checkbox \"does not exist\""
62
+ running do
63
+ @session.check('does not exist')
64
+ end.should raise_error(Capybara::ElementNotFound, msg)
62
65
  end
63
66
  end
64
67
  end
@@ -19,7 +19,10 @@ shared_examples_for "choose" do
19
19
 
20
20
  context "with a locator that doesn't exist" do
21
21
  it "should raise an error" do
22
- running { @session.choose('does not exist') }.should raise_error(Capybara::ElementNotFound)
22
+ msg = "Unable to find radio button \"does not exist\""
23
+ running do
24
+ @session.choose('does not exist')
25
+ end.should raise_error(Capybara::ElementNotFound, msg)
23
26
  end
24
27
  end
25
28
  end
@@ -27,7 +27,7 @@ shared_examples_for "click_button" do
27
27
  extract_results(@session)['no_action'].should == 'No Action'
28
28
  end
29
29
  end
30
-
30
+
31
31
  context "with value given on a submit button" do
32
32
  context "on a form with HTML5 fields" do
33
33
  before do
@@ -138,7 +138,7 @@ shared_examples_for "click_button" do
138
138
  @session.body.should include('You landed')
139
139
  end
140
140
  end
141
-
141
+
142
142
  context "with title given on a submit button" do
143
143
  it "should submit the associated form" do
144
144
  @session.click_button('What an Awesome Button')
@@ -204,11 +204,6 @@ shared_examples_for "click_button" do
204
204
  @session.click_button('Click')
205
205
  extract_results(@session)['first_name'].should == 'John'
206
206
  end
207
-
208
- it "should prefer exact matches over partial matches" do
209
- @session.click_button('Just an input')
210
- extract_results(@session)['button'].should == 'button_second'
211
- end
212
207
  end
213
208
 
214
209
  context "with id given on a button defined by <button> tag" do
@@ -236,11 +231,6 @@ shared_examples_for "click_button" do
236
231
  @session.click_button('ck_me')
237
232
  extract_results(@session)['first_name'].should == 'John'
238
233
  end
239
-
240
- it "should prefer exact matches over partial matches" do
241
- @session.click_button('Just a button')
242
- extract_results(@session)['button'].should == 'Just a button'
243
- end
244
234
  end
245
235
 
246
236
  context "with title given on a button defined by <button> tag" do
@@ -256,9 +246,10 @@ shared_examples_for "click_button" do
256
246
  end
257
247
  context "with a locator that doesn't exist" do
258
248
  it "should raise an error" do
249
+ msg = "Unable to find button \"does not exist\""
259
250
  running do
260
251
  @session.click_button('does not exist')
261
- end.should raise_error(Capybara::ElementNotFound)
252
+ end.should raise_error(Capybara::ElementNotFound, msg)
262
253
  end
263
254
  end
264
255
 
@@ -267,7 +258,7 @@ shared_examples_for "click_button" do
267
258
  @results = extract_results(@session)
268
259
  @results['no_value'].should_not be_nil
269
260
  end
270
-
261
+
271
262
  it "should not send image buttons that were not clicked" do
272
263
  @session.click_button('Click me!')
273
264
  @results = extract_results(@session)
@@ -27,9 +27,10 @@ shared_examples_for "click_link_or_button" do
27
27
  context "with a locator that doesn't exist" do
28
28
  it "should raise an error" do
29
29
  @session.visit('/with_html')
30
+ msg = "Unable to find link or button \"does not exist\""
30
31
  running do
31
32
  @session.click_link_or_button('does not exist')
32
- end.should raise_error(Capybara::ElementNotFound)
33
+ end.should raise_error(Capybara::ElementNotFound, msg)
33
34
  end
34
35
  end
35
36
  end
@@ -21,11 +21,6 @@ shared_examples_for "click_link" do
21
21
  @session.click_link('abo')
22
22
  @session.body.should include('Bar')
23
23
  end
24
-
25
- it "should prefer exact matches over partial matches" do
26
- @session.click_link('A link')
27
- @session.body.should include('Bar')
28
- end
29
24
  end
30
25
 
31
26
  context "with title given" do
@@ -38,11 +33,6 @@ shared_examples_for "click_link" do
38
33
  @session.click_link('some tit')
39
34
  @session.body.should include('Bar')
40
35
  end
41
-
42
- it "should prefer exact matches over partial matches" do
43
- @session.click_link('a fine link')
44
- @session.body.should include('Bar')
45
- end
46
36
  end
47
37
 
48
38
  context "with alternative text given to a contained image" do
@@ -55,18 +45,14 @@ shared_examples_for "click_link" do
55
45
  @session.click_link('some imag')
56
46
  @session.body.should include('Bar')
57
47
  end
58
-
59
- it "should prefer exact matches over partial matches" do
60
- @session.click_link('fine image')
61
- @session.body.should include('Bar')
62
- end
63
48
  end
64
49
 
65
50
  context "with a locator that doesn't exist" do
66
51
  it "should raise an error" do
52
+ msg = "Unable to find link \"does not exist\""
67
53
  running do
68
54
  @session.click_link('does not exist')
69
- end.should raise_error(Capybara::ElementNotFound)
55
+ end.should raise_error(Capybara::ElementNotFound, msg)
70
56
  end
71
57
  end
72
58
 
@@ -93,7 +79,7 @@ shared_examples_for "click_link" do
93
79
 
94
80
  it "should do nothing on anchor links" do
95
81
  @session.fill_in("test_field", :with => 'blah')
96
- @session.click_link('Anchor')
82
+ @session.click_link('Normal Anchor')
97
83
  @session.find_field("test_field").value.should == 'blah'
98
84
  @session.click_link('Blank Anchor')
99
85
  @session.find_field("test_field").value.should == 'blah'
@@ -1,15 +1,83 @@
1
1
  shared_examples_for "current_url" do
2
- describe '#current_url' do
3
- it "should return the current url" do
4
- @session.visit('/form')
5
- @session.current_url.should =~ %r(http://[^/]+/form)
6
- end
2
+ before :all do
3
+ @servers = 2.times.map { Capybara::Server.new(TestApp.clone).boot }
4
+ # sanity check
5
+ @servers[0].port.should_not == @servers[1].port
6
+ @servers.map { |s| s.port }.should_not include 80
7
+ end
8
+
9
+ def bases
10
+ @servers.map { |s| "http://#{s.host}:#{s.port}" }
7
11
  end
8
12
 
9
- describe '#current_path' do
10
- it 'should show the correct location' do
11
- @session.visit('/foo')
12
- @session.current_path.should == '/foo'
13
+ describe '#current_url, #current_path, #current_host' do
14
+ def should_be_on server_index, path="/host", scheme="http"
15
+ # Check that we are on /host on the given server
16
+ s = @servers[server_index]
17
+ @session.current_url.chomp('?').should == "#{scheme}://#{s.host}:#{s.port}#{path}"
18
+ @session.current_host.should == "#{scheme}://#{s.host}" # no port
19
+ @session.current_path.should == path
20
+ if path == '/host'
21
+ # Server should agree with us
22
+ @session.body.should include("Current host is #{scheme}://#{s.host}:#{s.port}")
23
+ end
24
+ end
25
+
26
+ def visit_host_links
27
+ @session.visit("#{bases[0]}/host_links?absolute_host=#{bases[1]}")
28
+ end
29
+
30
+ it "is affected by visiting a page directly" do
31
+ @session.visit("#{bases[0]}/host")
32
+ should_be_on 0
33
+ end
34
+
35
+ it "returns to the app host when visiting a relative url" do
36
+ Capybara.app_host = bases[1]
37
+ @session.visit("#{bases[0]}/host")
38
+ should_be_on 0
39
+ @session.visit('/host')
40
+ should_be_on 1
41
+ Capybara.app_host = nil
42
+ end
43
+
44
+ it "is affected by setting Capybara.app_host" do
45
+ Capybara.app_host = bases[0]
46
+ @session.visit("/host")
47
+ should_be_on 0
48
+ Capybara.app_host = bases[1]
49
+ @session.visit("/host")
50
+ should_be_on 1
51
+ Capybara.app_host = nil
52
+ end
53
+
54
+ it "is unaffected by following a relative link" do
55
+ visit_host_links
56
+ @session.click_link("Relative Host")
57
+ should_be_on 0
58
+ end
59
+
60
+ it "is affected by following an absolute link" do
61
+ visit_host_links
62
+ @session.click_link("Absolute Host")
63
+ should_be_on 1
64
+ end
65
+
66
+ it "is unaffected by posting through a relative form" do
67
+ visit_host_links
68
+ @session.click_button("Relative Host")
69
+ should_be_on 0
70
+ end
71
+
72
+ it "is affected by posting through an absolute form" do
73
+ visit_host_links
74
+ @session.click_button("Absolute Host")
75
+ should_be_on 1
76
+ end
77
+
78
+ it "is affected by following a redirect" do
79
+ @session.visit("#{bases[0]}/redirect")
80
+ should_be_on 0, "/landed"
13
81
  end
14
82
  end
15
83
  end