capybara 3.31.0 → 3.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +93 -13
  3. data/README.md +9 -4
  4. data/lib/capybara.rb +18 -8
  5. data/lib/capybara/config.rb +4 -6
  6. data/lib/capybara/cucumber.rb +1 -1
  7. data/lib/capybara/driver/base.rb +4 -0
  8. data/lib/capybara/helpers.rb +25 -1
  9. data/lib/capybara/minitest.rb +215 -141
  10. data/lib/capybara/minitest/spec.rb +156 -97
  11. data/lib/capybara/node/actions.rb +16 -21
  12. data/lib/capybara/node/element.rb +3 -5
  13. data/lib/capybara/node/finders.rb +7 -6
  14. data/lib/capybara/node/matchers.rb +11 -11
  15. data/lib/capybara/node/simple.rb +5 -1
  16. data/lib/capybara/queries/ancestor_query.rb +1 -1
  17. data/lib/capybara/queries/current_path_query.rb +14 -4
  18. data/lib/capybara/queries/selector_query.rb +16 -10
  19. data/lib/capybara/queries/sibling_query.rb +1 -1
  20. data/lib/capybara/queries/style_query.rb +1 -1
  21. data/lib/capybara/queries/text_query.rb +7 -1
  22. data/lib/capybara/rack_test/browser.rb +9 -3
  23. data/lib/capybara/rack_test/driver.rb +1 -0
  24. data/lib/capybara/rack_test/form.rb +1 -1
  25. data/lib/capybara/rack_test/node.rb +1 -1
  26. data/lib/capybara/registration_container.rb +44 -0
  27. data/lib/capybara/registrations/patches/puma_ssl.rb +3 -1
  28. data/lib/capybara/registrations/servers.rb +2 -1
  29. data/lib/capybara/result.rb +8 -8
  30. data/lib/capybara/rspec.rb +2 -0
  31. data/lib/capybara/rspec/matcher_proxies.rb +5 -5
  32. data/lib/capybara/rspec/matchers.rb +7 -6
  33. data/lib/capybara/rspec/matchers/have_current_path.rb +2 -2
  34. data/lib/capybara/rspec/matchers/have_text.rb +1 -1
  35. data/lib/capybara/rspec/matchers/match_style.rb +5 -0
  36. data/lib/capybara/selector.rb +10 -1
  37. data/lib/capybara/selector/definition.rb +11 -9
  38. data/lib/capybara/selector/definition/button.rb +8 -5
  39. data/lib/capybara/selector/definition/css.rb +1 -1
  40. data/lib/capybara/selector/definition/datalist_input.rb +1 -1
  41. data/lib/capybara/selector/definition/element.rb +2 -1
  42. data/lib/capybara/selector/definition/fillable_field.rb +1 -1
  43. data/lib/capybara/selector/definition/label.rb +1 -1
  44. data/lib/capybara/selector/definition/link.rb +8 -0
  45. data/lib/capybara/selector/definition/select.rb +1 -1
  46. data/lib/capybara/selector/definition/table.rb +1 -1
  47. data/lib/capybara/selector/definition/table_row.rb +1 -1
  48. data/lib/capybara/selector/filter_set.rb +2 -2
  49. data/lib/capybara/selector/selector.rb +9 -1
  50. data/lib/capybara/selenium/atoms/getAttribute.min.js +1 -1
  51. data/lib/capybara/selenium/atoms/src/getAttribute.js +1 -1
  52. data/lib/capybara/selenium/driver.rb +35 -6
  53. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +9 -11
  54. data/lib/capybara/selenium/driver_specializations/edge_driver.rb +9 -11
  55. data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +3 -3
  56. data/lib/capybara/selenium/extensions/find.rb +3 -3
  57. data/lib/capybara/selenium/extensions/scroll.rb +8 -10
  58. data/lib/capybara/selenium/node.rb +75 -12
  59. data/lib/capybara/selenium/nodes/chrome_node.rb +20 -11
  60. data/lib/capybara/selenium/nodes/firefox_node.rb +2 -2
  61. data/lib/capybara/selenium/nodes/safari_node.rb +1 -1
  62. data/lib/capybara/selenium/patches/action_pauser.rb +26 -0
  63. data/lib/capybara/selenium/patches/atoms.rb +4 -4
  64. data/lib/capybara/selenium/patches/logs.rb +7 -9
  65. data/lib/capybara/server/animation_disabler.rb +3 -2
  66. data/lib/capybara/server/middleware.rb +4 -2
  67. data/lib/capybara/session.rb +23 -14
  68. data/lib/capybara/session/config.rb +3 -1
  69. data/lib/capybara/session/matchers.rb +11 -11
  70. data/lib/capybara/spec/public/test.js +24 -1
  71. data/lib/capybara/spec/session/accept_alert_spec.rb +1 -1
  72. data/lib/capybara/spec/session/check_spec.rb +6 -0
  73. data/lib/capybara/spec/session/click_button_spec.rb +11 -0
  74. data/lib/capybara/spec/session/current_url_spec.rb +11 -1
  75. data/lib/capybara/spec/session/fill_in_spec.rb +9 -0
  76. data/lib/capybara/spec/session/find_spec.rb +11 -8
  77. data/lib/capybara/spec/session/has_button_spec.rb +18 -0
  78. data/lib/capybara/spec/session/has_css_spec.rb +11 -7
  79. data/lib/capybara/spec/session/has_current_path_spec.rb +15 -2
  80. data/lib/capybara/spec/session/has_field_spec.rb +16 -0
  81. data/lib/capybara/spec/session/has_select_spec.rb +4 -4
  82. data/lib/capybara/spec/session/has_selector_spec.rb +4 -4
  83. data/lib/capybara/spec/session/has_text_spec.rb +0 -11
  84. data/lib/capybara/spec/session/matches_style_spec.rb +2 -2
  85. data/lib/capybara/spec/session/node_spec.rb +76 -29
  86. data/lib/capybara/spec/session/refresh_spec.rb +1 -0
  87. data/lib/capybara/spec/session/save_page_spec.rb +4 -4
  88. data/lib/capybara/spec/session/window/window_spec.rb +7 -7
  89. data/lib/capybara/spec/spec_helper.rb +13 -14
  90. data/lib/capybara/spec/test_app.rb +22 -21
  91. data/lib/capybara/spec/views/form.erb +25 -1
  92. data/lib/capybara/spec/views/with_animation.erb +8 -0
  93. data/lib/capybara/spec/views/with_dragula.erb +3 -1
  94. data/lib/capybara/spec/views/with_html.erb +2 -2
  95. data/lib/capybara/spec/views/with_js.erb +2 -0
  96. data/lib/capybara/spec/views/with_sortable_js.erb +1 -1
  97. data/lib/capybara/version.rb +1 -1
  98. data/lib/capybara/window.rb +3 -7
  99. data/spec/basic_node_spec.rb +9 -8
  100. data/spec/capybara_spec.rb +1 -1
  101. data/spec/dsl_spec.rb +14 -1
  102. data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
  103. data/spec/minitest_spec.rb +3 -2
  104. data/spec/rack_test_spec.rb +28 -5
  105. data/spec/regexp_dissassembler_spec.rb +0 -4
  106. data/spec/result_spec.rb +38 -31
  107. data/spec/rspec/features_spec.rb +3 -1
  108. data/spec/rspec/scenarios_spec.rb +4 -0
  109. data/spec/rspec/shared_spec_matchers.rb +63 -51
  110. data/spec/rspec_spec.rb +4 -0
  111. data/spec/selector_spec.rb +2 -1
  112. data/spec/selenium_spec_chrome.rb +4 -2
  113. data/spec/selenium_spec_chrome_remote.rb +2 -0
  114. data/spec/server_spec.rb +56 -49
  115. data/spec/shared_selenium_node.rb +18 -0
  116. data/spec/shared_selenium_session.rb +84 -7
  117. data/spec/spec_helper.rb +1 -1
  118. metadata +25 -24
  119. data/lib/capybara/spec/session/source_spec.rb +0 -0
@@ -25,6 +25,7 @@ Capybara::SpecHelper.spec '#refresh' do
25
25
  @session.visit('/form')
26
26
  @session.select('Sweden', from: 'form_region')
27
27
  @session.click_button('awesome')
28
+ sleep 2
28
29
  expect do
29
30
  @session.refresh
30
31
  sleep 2
@@ -31,7 +31,7 @@ Capybara::SpecHelper.spec '#save_page' do
31
31
  it 'can store files in a specified directory' do
32
32
  Capybara.save_path = alternative_path
33
33
  @session.save_page
34
- path = Dir.glob(alternative_path + '/capybara-*.html').first
34
+ path = Dir.glob("#{alternative_path}/capybara-*.html").first
35
35
  expect(File.read(path)).to include('Another World')
36
36
  end
37
37
 
@@ -43,14 +43,14 @@ Capybara::SpecHelper.spec '#save_page' do
43
43
  it 'can store files in a specified directory with a given filename' do
44
44
  Capybara.save_path = alternative_path
45
45
  @session.save_page('capybara-001133.html')
46
- path = alternative_path + '/capybara-001133.html'
46
+ path = "#{alternative_path}/capybara-001133.html"
47
47
  expect(File.read(path)).to include('Another World')
48
48
  end
49
49
 
50
50
  it 'can store files in a specified directory with a given relative filename' do
51
51
  Capybara.save_path = alternative_path
52
52
  @session.save_page('tmp/capybara-001144.html')
53
- path = alternative_path + '/tmp/capybara-001144.html'
53
+ path = "#{alternative_path}/tmp/capybara-001144.html"
54
54
  expect(File.read(path)).to include('Another World')
55
55
  end
56
56
 
@@ -63,7 +63,7 @@ Capybara::SpecHelper.spec '#save_page' do
63
63
  it 'returns an absolute path in given directory' do
64
64
  Capybara.save_path = alternative_path
65
65
  result = @session.save_page
66
- path = File.expand_path(Dir.glob(alternative_path + '/capybara-*.html').first, alternative_path)
66
+ path = File.expand_path(Dir.glob("#{alternative_path}/capybara-*.html").first, alternative_path)
67
67
  expect(result).to eq(path)
68
68
  end
69
69
 
@@ -141,12 +141,12 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
141
141
  end
142
142
 
143
143
  describe '#maximize' do
144
- before do
145
- @initial_size = @session.current_window.size
144
+ let! :initial_size do
145
+ @session.current_window.size
146
146
  end
147
147
 
148
148
  after do
149
- @session.current_window.resize_to(*@initial_size)
149
+ @session.current_window.resize_to(*initial_size)
150
150
  sleep 0.5
151
151
  end
152
152
 
@@ -176,7 +176,7 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
176
176
 
177
177
  expect(@session.current_window).to eq(orig_window)
178
178
  # Maximizing the browser affects all tabs so this may not be valid in real browsers
179
- # expect(@session.current_window.size).to eq(@initial_size)
179
+ # expect(@session.current_window.size).to eq(initial_size)
180
180
 
181
181
  ow_width, ow_height = other_window.size
182
182
  expect(ow_width).to be > 400
@@ -185,12 +185,12 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
185
185
  end
186
186
 
187
187
  describe '#fullscreen' do
188
- before do
189
- @initial_size = @session.current_window.size
188
+ let! :initial_size do
189
+ @session.current_window.size
190
190
  end
191
191
 
192
192
  after do
193
- @session.current_window.resize_to(*@initial_size)
193
+ @session.current_window.resize_to(*initial_size)
194
194
  sleep 1
195
195
  end
196
196
 
@@ -30,6 +30,7 @@ module Capybara
30
30
  Capybara.visible_text_only = false
31
31
  Capybara.match = :smart
32
32
  Capybara.enable_aria_label = false
33
+ Capybara.enable_aria_role = false
33
34
  Capybara.default_set_options = {}
34
35
  Capybara.disable_animation = false
35
36
  Capybara.test_id = nil
@@ -57,10 +58,10 @@ module Capybara
57
58
 
58
59
  def run_specs(session, name, **options, &filter_block)
59
60
  specs = @specs
60
- RSpec.describe Capybara::Session, name, options do # rubocop:disable RSpec/EmptyExampleGroup
61
+ RSpec.describe Capybara::Session, name, options do
61
62
  include Capybara::SpecHelper
62
63
  include Capybara::RSpecMatchers
63
- # rubocop:disable RSpec/ScatteredSetup
64
+
64
65
  before do |example|
65
66
  @session = session
66
67
  instance_exec(example, &filter_block) if filter_block
@@ -71,28 +72,28 @@ module Capybara
71
72
  end
72
73
 
73
74
  before :each, psc: true do
74
- SpecHelper.reset_threadsafe(true, session)
75
+ SpecHelper.reset_threadsafe(bool: true, session: session)
75
76
  end
76
77
 
77
78
  after psc: true do
78
- SpecHelper.reset_threadsafe(false, session)
79
+ SpecHelper.reset_threadsafe(session: session)
79
80
  end
80
81
 
81
82
  before :each, :exact_false do
82
83
  Capybara.exact = false
83
84
  end
84
- # rubocop:enable RSpec/ScatteredSetup
85
85
 
86
86
  specs.each do |spec_name, spec_options, block|
87
- describe spec_name, *spec_options do # rubocop:disable RSpec/EmptyExampleGroup
87
+ describe spec_name, *spec_options do
88
88
  class_eval(&block)
89
89
  end
90
90
  end
91
91
  end
92
92
  end
93
93
 
94
- def reset_threadsafe(bool = false, session = nil)
95
- Capybara::Session.class_variable_set(:@@instance_created, false) # Work around limit on when threadsafe can be changed
94
+ def reset_threadsafe(bool: false, session: nil)
95
+ # Work around limit on when threadsafe can be changed
96
+ Capybara::Session.class_variable_set(:@@instance_created, false) # rubocop:disable Style/ClassVars
96
97
  Capybara.threadsafe = bool
97
98
  session = session.current_session if session.respond_to?(:current_session)
98
99
  session&.instance_variable_set(:@config, nil)
@@ -108,11 +109,9 @@ module Capybara
108
109
  stream.reopen(old_stream)
109
110
  end
110
111
 
111
- def quietly
112
- silence_stream(STDOUT) do
113
- silence_stream(STDERR) do
114
- yield
115
- end
112
+ def quietly(&block)
113
+ silence_stream($stdout) do
114
+ silence_stream($stderr, &block)
116
115
  end
117
116
  end
118
117
 
@@ -132,4 +131,4 @@ module Capybara
132
131
  end
133
132
  end
134
133
 
135
- Dir[File.dirname(__FILE__) + '/session/**/*.rb'].each { |file| require_relative file }
134
+ Dir["#{File.dirname(__FILE__)}/session/**/*.rb"].each { |file| require_relative file }
@@ -9,6 +9,7 @@ class TestApp < Sinatra::Base
9
9
  class TestAppError < Exception; end # rubocop:disable Lint/InheritException
10
10
  class TestAppOtherError < Exception # rubocop:disable Lint/InheritException
11
11
  def initialize(string1, msg)
12
+ super()
12
13
  @something = string1
13
14
  @message = msg
14
15
  end
@@ -33,6 +34,10 @@ class TestApp < Sinatra::Base
33
34
  redirect '/redirect_again'
34
35
  end
35
36
 
37
+ get '/redirect_with_fragment' do
38
+ redirect '/landed#with_fragment'
39
+ end
40
+
36
41
  get '/redirect_again' do
37
42
  redirect '/landed'
38
43
  end
@@ -85,11 +90,11 @@ class TestApp < Sinatra::Base
85
90
  end
86
91
 
87
92
  get '/form/get' do
88
- '<pre id="results">' + params[:form].to_yaml + '</pre>'
93
+ %(<pre id="results">#{params[:form].to_yaml}</pre>)
89
94
  end
90
95
 
91
96
  post '/relative' do
92
- '<pre id="results">' + params[:form].to_yaml + '</pre>'
97
+ %(<pre id="results">#{params[:form].to_yaml}</pre>)
93
98
  end
94
99
 
95
100
  get '/favicon.ico' do
@@ -176,7 +181,7 @@ class TestApp < Sinatra::Base
176
181
 
177
182
  post '/form' do
178
183
  self.class.form_post_count += 1
179
- '<pre id="results">' + params[:form].merge('post_count' => self.class.form_post_count).to_yaml + '</pre>'
184
+ %(<pre id="results">#{params[:form].merge('post_count' => self.class.form_post_count).to_yaml}</pre>)
180
185
  end
181
186
 
182
187
  post '/upload_empty' do
@@ -188,28 +193,24 @@ class TestApp < Sinatra::Base
188
193
  end
189
194
 
190
195
  post '/upload' do
191
- begin
192
- buffer = []
193
- buffer << "Content-type: #{params.dig(:form, :document, :type)}"
194
- buffer << "File content: #{params.dig(:form, :document, :tempfile).read}"
195
- buffer.join(' | ')
196
- rescue StandardError
197
- 'No file uploaded'
198
- end
196
+ buffer = []
197
+ buffer << "Content-type: #{params.dig(:form, :document, :type)}"
198
+ buffer << "File content: #{params.dig(:form, :document, :tempfile).read}"
199
+ buffer.join(' | ')
200
+ rescue StandardError
201
+ 'No file uploaded'
199
202
  end
200
203
 
201
204
  post '/upload_multiple' do
202
- begin
203
- docs = params.dig(:form, :multiple_documents)
204
- buffer = [docs.size.to_s]
205
- docs.each do |doc|
206
- buffer << "Content-type: #{doc[:type]}"
207
- buffer << "File content: #{doc[:tempfile].read}"
208
- end
209
- buffer.join(' | ')
210
- rescue StandardError
211
- 'No files uploaded'
205
+ docs = params.dig(:form, :multiple_documents)
206
+ buffer = [docs.size.to_s]
207
+ docs.each do |doc|
208
+ buffer << "Content-type: #{doc[:type]}"
209
+ buffer << "File content: #{doc[:tempfile].read}"
212
210
  end
211
+ buffer.join(' | ')
212
+ rescue StandardError
213
+ 'No files uploaded'
213
214
  end
214
215
 
215
216
  get '/apple-touch-icon-precomposed.png' do
@@ -140,7 +140,11 @@
140
140
 
141
141
  <p>
142
142
  <label for="form_zipcode">Zipcode</label>
143
- <input type="text" maxlength="5" name="form[zipcode]" id="form_zipcode" />
143
+ <input type="text" maxlength="5" name="form[zipcode]" id="form_zipcode" pattern="[0-9]{5,9}" />
144
+ </p>
145
+
146
+ <p>
147
+ <input maxlength="35" id="long_length" />
144
148
  </p>
145
149
 
146
150
  <p>
@@ -452,7 +456,14 @@ New line after and before textarea tag
452
456
  <button type="submit" name="form[no_value]">No Value!</button>
453
457
  <button id="no_type">No Type!</button>
454
458
  <button><img alt="A horse eating hay"/></button>
459
+ <button id="button_with_label"></button>
460
+ <label for="button_with_label">button with label element</label>
461
+ <label>
462
+ button within label element
463
+ <button></button>
464
+ </label>
455
465
  <input type="button" disabled="disabled" value="Disabled button"/>
466
+ <span role="button">ARIA button</span>
456
467
  </p>
457
468
 
458
469
  <p>
@@ -517,6 +528,7 @@ New line after and before textarea tag
517
528
 
518
529
  <p>
519
530
  <input type="submit" name="form[mediocre]" id="mediocre" value="med" aria-label="Mediocre Button"/>
531
+ <input type="submit" formaction="/form/get?bar=foo" id="mediocre2" value="med2"/>
520
532
  <p>
521
533
  </form>
522
534
 
@@ -678,3 +690,15 @@ New line after and before textarea tag
678
690
  <p>
679
691
  <input id="special" {custom}="abcdef" value="custom attribute"/>
680
692
  </p>
693
+
694
+
695
+ <label for="multi_label_checkbox">
696
+ Label to click
697
+ </label>
698
+ <div>Something random that justifies the usage of a separate label</div>
699
+ <label>
700
+ <div>
701
+ <input type="checkbox" id="multi_label_checkbox" style="display: none"/>
702
+ <div>Visual representation of the checkbox</div>
703
+ </div>
704
+ </label>
@@ -18,6 +18,14 @@
18
18
  });
19
19
  </script>
20
20
  <style>
21
+ html {
22
+ scroll-behavior: smooth;
23
+ }
24
+
25
+ body {
26
+ min-height: 2000px;
27
+ }
28
+
21
29
  .transition.away {
22
30
  width: 0%;
23
31
  }
@@ -15,7 +15,9 @@
15
15
  </div>
16
16
  <script src="https://cdnjs.cloudflare.com/ajax/libs/dragula/3.7.2/dragula.js" type="text/javascript"></script>
17
17
  <script>
18
- dragula([document.getElementById("sortable")]);
18
+ let container = document.getElementById("sortable");
19
+ dragula([container]);
20
+ container.className = "ready"
19
21
  </script>
20
22
  </body>
21
23
  </html>
@@ -36,8 +36,8 @@
36
36
  </p>
37
37
 
38
38
  <p>
39
- <input type="text" id="test_field" data-test-id="test_id" value="monkey"/>
40
- <input type="text" readonly="readonly" value="should not change" />
39
+ <input type="text" id="test_field" spellcheck="TRUE" data-test-id="test_id" value="monkey"/>
40
+ <input type="text" readonly="readonly" spellcheck="FALSE" value="should not change" />
41
41
  <textarea id="normal" data-other-test-id="test_id">
42
42
  banana</textarea>
43
43
  <textarea id="additional_newline">
@@ -35,6 +35,7 @@
35
35
 
36
36
  <p><a href="#" id="clickable">Click me</a></p>
37
37
  <p><a href="#" id="slow-click">Slowly</a></p>
38
+ <p><span id="aria-button" role="button">ARIA button</span></p>
38
39
 
39
40
  <p>
40
41
  <select id="waiter">
@@ -151,6 +152,7 @@
151
152
  <p>This is an HTML5 draggable element.</p>
152
153
  </div>
153
154
 
155
+ <div id="shadow"></div>
154
156
  <script type="text/javascript">
155
157
  // a javascript comment
156
158
  var aVar = 123;
@@ -2,7 +2,7 @@
2
2
  <head>
3
3
  <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
4
4
  <title>with_sortable_js</title>
5
- <script src="https://sortablejs.github.io/Sortable/Sortable.js" type="text/javascript"></script>
5
+ <script src="https://cdn.jsdelivr.net/npm/sortablejs@1.12.0/dist/sortable.umd.min.js" type="text/javascript"></script>
6
6
  </head>
7
7
 
8
8
  <body id="with_sortable_js">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Capybara
4
- VERSION = '3.31.0'
4
+ VERSION = '3.34.0'
5
5
  end
@@ -4,7 +4,7 @@ module Capybara
4
4
  ##
5
5
  # The {Window} class represents a browser window.
6
6
  #
7
- # You can get an instance of the class by calling either of:
7
+ # You can get an instance of the class by calling any of:
8
8
  #
9
9
  # * {Capybara::Session#windows}
10
10
  # * {Capybara::Session#current_window}
@@ -82,8 +82,8 @@ module Capybara
82
82
  # Resize window.
83
83
  #
84
84
  # @macro about_current
85
- # @param width [String] the new window width in pixels
86
- # @param height [String] the new window height in pixels
85
+ # @param width [Integer] the new window width in pixels
86
+ # @param height [Integer] the new window height in pixels
87
87
  #
88
88
  def resize_to(width, height)
89
89
  wait_for_stable_size { @driver.resize_window_to(handle, width, height) }
@@ -138,9 +138,5 @@ module Capybara
138
138
  end
139
139
  raise Capybara::WindowError, "Window size not stable within #{seconds} seconds."
140
140
  end
141
-
142
- def raise_unless_current(what)
143
- raise Capybara::WindowError, "#{what} not current window is not possible." unless current?
144
- end
145
141
  end
146
142
  end
@@ -3,6 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  RSpec.describe Capybara do
6
+ include Capybara::RSpecMatchers
6
7
  describe '.string' do
7
8
  let :string do
8
9
  described_class.string <<-STRING
@@ -129,25 +130,25 @@ RSpec.describe Capybara do
129
130
 
130
131
  describe '#has_title?' do
131
132
  it 'returns whether the page has the given title' do
132
- expect(string.has_title?('simple_node')).to be_truthy
133
- expect(string.has_title?('monkey')).to be_falsey
133
+ expect(string.has_title?('simple_node')).to be true
134
+ expect(string.has_title?('monkey')).to be false
134
135
  end
135
136
 
136
137
  it 'allows regexp matches' do
137
- expect(string.has_title?(/s[a-z]+_node/)).to be_truthy
138
- expect(string.has_title?(/monkey/)).to be_falsey
138
+ expect(string.has_title?(/s[a-z]+_node/)).to be true
139
+ expect(string.has_title?(/monkey/)).to be false
139
140
  end
140
141
  end
141
142
 
142
143
  describe '#has_no_title?' do
143
144
  it 'returns whether the page does not have the given title' do
144
- expect(string.has_no_title?('simple_node')).to be_falsey
145
- expect(string.has_no_title?('monkey')).to be_truthy
145
+ expect(string.has_no_title?('simple_node')).to be false
146
+ expect(string.has_no_title?('monkey')).to be true
146
147
  end
147
148
 
148
149
  it 'allows regexp matches' do
149
- expect(string.has_no_title?(/s[a-z]+_node/)).to be_falsey
150
- expect(string.has_no_title?(/monkey/)).to be_truthy
150
+ expect(string.has_no_title?(/s[a-z]+_node/)).to be false
151
+ expect(string.has_no_title?(/monkey/)).to be true
151
152
  end
152
153
  end
153
154
  end
@@ -32,7 +32,7 @@ RSpec.describe Capybara do
32
32
  # do nothing
33
33
  end
34
34
 
35
- expect(described_class.servers).to have_key(:blob)
35
+ expect(described_class.servers[:blob]).to be_truthy
36
36
  end
37
37
  end
38
38