capybara 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +16 -0
  3. data/README.md +5 -7
  4. data/lib/capybara.rb +7 -6
  5. data/lib/capybara/config.rb +1 -1
  6. data/lib/capybara/dsl.rb +2 -2
  7. data/lib/capybara/helpers.rb +3 -3
  8. data/lib/capybara/minitest/spec.rb +3 -3
  9. data/lib/capybara/node/actions.rb +18 -18
  10. data/lib/capybara/node/base.rb +1 -1
  11. data/lib/capybara/node/element.rb +2 -2
  12. data/lib/capybara/node/finders.rb +6 -6
  13. data/lib/capybara/node/matchers.rb +5 -5
  14. data/lib/capybara/node/simple.rb +2 -2
  15. data/lib/capybara/queries/ancestor_query.rb +1 -1
  16. data/lib/capybara/queries/base_query.rb +12 -11
  17. data/lib/capybara/queries/current_path_query.rb +1 -1
  18. data/lib/capybara/queries/selector_query.rb +39 -15
  19. data/lib/capybara/queries/sibling_query.rb +1 -1
  20. data/lib/capybara/queries/text_query.rb +1 -1
  21. data/lib/capybara/rack_test/browser.rb +7 -7
  22. data/lib/capybara/rack_test/driver.rb +1 -1
  23. data/lib/capybara/rack_test/form.rb +7 -7
  24. data/lib/capybara/rack_test/node.rb +16 -16
  25. data/lib/capybara/rails.rb +1 -1
  26. data/lib/capybara/result.rb +8 -4
  27. data/lib/capybara/rspec/features.rb +4 -4
  28. data/lib/capybara/rspec/matchers.rb +6 -6
  29. data/lib/capybara/selector.rb +106 -90
  30. data/lib/capybara/selector/css.rb +4 -4
  31. data/lib/capybara/selector/filter_set.rb +52 -8
  32. data/lib/capybara/selector/selector.rb +39 -15
  33. data/lib/capybara/selenium/driver.rb +10 -10
  34. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +8 -0
  35. data/lib/capybara/selenium/node.rb +9 -10
  36. data/lib/capybara/selenium/nodes/chrome_node.rb +18 -0
  37. data/lib/capybara/selenium/nodes/marionette_node.rb +32 -7
  38. data/lib/capybara/server.rb +3 -3
  39. data/lib/capybara/server/animation_disabler.rb +1 -1
  40. data/lib/capybara/server/middleware.rb +1 -1
  41. data/lib/capybara/session.rb +23 -19
  42. data/lib/capybara/session/config.rb +18 -3
  43. data/lib/capybara/spec/public/test.js +1 -1
  44. data/lib/capybara/spec/session/accept_alert_spec.rb +10 -10
  45. data/lib/capybara/spec/session/accept_confirm_spec.rb +3 -3
  46. data/lib/capybara/spec/session/accept_prompt_spec.rb +9 -10
  47. data/lib/capybara/spec/session/all_spec.rb +33 -32
  48. data/lib/capybara/spec/session/ancestor_spec.rb +19 -19
  49. data/lib/capybara/spec/session/assert_all_of_selectors_spec.rb +38 -38
  50. data/lib/capybara/spec/session/assert_current_path_spec.rb +16 -16
  51. data/lib/capybara/spec/session/assert_selector_spec.rb +53 -53
  52. data/lib/capybara/spec/session/assert_style_spec.rb +3 -3
  53. data/lib/capybara/spec/session/assert_text_spec.rb +31 -30
  54. data/lib/capybara/spec/session/assert_title_spec.rb +12 -12
  55. data/lib/capybara/spec/session/attach_file_spec.rb +51 -52
  56. data/lib/capybara/spec/session/body_spec.rb +6 -6
  57. data/lib/capybara/spec/session/check_spec.rb +52 -47
  58. data/lib/capybara/spec/session/choose_spec.rb +32 -32
  59. data/lib/capybara/spec/session/click_button_spec.rb +103 -103
  60. data/lib/capybara/spec/session/click_link_or_button_spec.rb +24 -23
  61. data/lib/capybara/spec/session/click_link_spec.rb +49 -48
  62. data/lib/capybara/spec/session/current_scope_spec.rb +7 -7
  63. data/lib/capybara/spec/session/current_url_spec.rb +26 -27
  64. data/lib/capybara/spec/session/dismiss_confirm_spec.rb +3 -3
  65. data/lib/capybara/spec/session/dismiss_prompt_spec.rb +2 -2
  66. data/lib/capybara/spec/session/element/assert_match_selector_spec.rb +8 -8
  67. data/lib/capybara/spec/session/element/match_css_spec.rb +10 -10
  68. data/lib/capybara/spec/session/element/match_xpath_spec.rb +6 -6
  69. data/lib/capybara/spec/session/element/matches_selector_spec.rb +51 -51
  70. data/lib/capybara/spec/session/evaluate_async_script_spec.rb +7 -7
  71. data/lib/capybara/spec/session/evaluate_script_spec.rb +15 -8
  72. data/lib/capybara/spec/session/execute_script_spec.rb +7 -7
  73. data/lib/capybara/spec/session/fill_in_spec.rb +43 -42
  74. data/lib/capybara/spec/session/find_button_spec.rb +23 -23
  75. data/lib/capybara/spec/session/find_by_id_spec.rb +7 -7
  76. data/lib/capybara/spec/session/find_field_spec.rb +32 -30
  77. data/lib/capybara/spec/session/find_link_spec.rb +21 -21
  78. data/lib/capybara/spec/session/find_spec.rb +153 -135
  79. data/lib/capybara/spec/session/first_spec.rb +41 -41
  80. data/lib/capybara/spec/session/frame/frame_title_spec.rb +5 -5
  81. data/lib/capybara/spec/session/frame/frame_url_spec.rb +5 -5
  82. data/lib/capybara/spec/session/frame/switch_to_frame_spec.rb +17 -17
  83. data/lib/capybara/spec/session/frame/within_frame_spec.rb +31 -17
  84. data/lib/capybara/spec/session/go_back_spec.rb +1 -1
  85. data/lib/capybara/spec/session/go_forward_spec.rb +1 -1
  86. data/lib/capybara/spec/session/has_all_selectors_spec.rb +17 -17
  87. data/lib/capybara/spec/session/has_button_spec.rb +13 -13
  88. data/lib/capybara/spec/session/has_css_spec.rb +133 -131
  89. data/lib/capybara/spec/session/has_current_path_spec.rb +29 -29
  90. data/lib/capybara/spec/session/has_field_spec.rb +58 -58
  91. data/lib/capybara/spec/session/has_link_spec.rb +4 -4
  92. data/lib/capybara/spec/session/has_none_selectors_spec.rb +24 -24
  93. data/lib/capybara/spec/session/has_select_spec.rb +43 -43
  94. data/lib/capybara/spec/session/has_selector_spec.rb +71 -71
  95. data/lib/capybara/spec/session/has_style_spec.rb +3 -3
  96. data/lib/capybara/spec/session/has_table_spec.rb +4 -4
  97. data/lib/capybara/spec/session/has_text_spec.rb +53 -52
  98. data/lib/capybara/spec/session/has_title_spec.rb +14 -14
  99. data/lib/capybara/spec/session/has_xpath_spec.rb +39 -38
  100. data/lib/capybara/spec/session/headers_spec.rb +1 -1
  101. data/lib/capybara/spec/session/html_spec.rb +6 -6
  102. data/lib/capybara/spec/session/node_spec.rb +129 -123
  103. data/lib/capybara/spec/session/node_wrapper_spec.rb +10 -7
  104. data/lib/capybara/spec/session/refresh_spec.rb +4 -7
  105. data/lib/capybara/spec/session/reset_session_spec.rb +28 -28
  106. data/lib/capybara/spec/session/response_code_spec.rb +1 -1
  107. data/lib/capybara/spec/session/save_and_open_page_spec.rb +2 -2
  108. data/lib/capybara/spec/session/save_page_spec.rb +37 -37
  109. data/lib/capybara/spec/session/save_screenshot_spec.rb +6 -6
  110. data/lib/capybara/spec/session/screenshot_spec.rb +2 -2
  111. data/lib/capybara/spec/session/select_spec.rb +81 -81
  112. data/lib/capybara/spec/session/selectors_spec.rb +17 -17
  113. data/lib/capybara/spec/session/sibling_spec.rb +9 -9
  114. data/lib/capybara/spec/session/text_spec.rb +23 -23
  115. data/lib/capybara/spec/session/title_spec.rb +5 -5
  116. data/lib/capybara/spec/session/uncheck_spec.rb +24 -20
  117. data/lib/capybara/spec/session/unselect_spec.rb +37 -37
  118. data/lib/capybara/spec/session/visit_spec.rb +48 -49
  119. data/lib/capybara/spec/session/window/current_window_spec.rb +1 -1
  120. data/lib/capybara/spec/session/window/switch_to_window_spec.rb +16 -16
  121. data/lib/capybara/spec/session/window/window_opened_by_spec.rb +2 -2
  122. data/lib/capybara/spec/session/window/window_spec.rb +4 -4
  123. data/lib/capybara/spec/session/window/within_window_spec.rb +14 -14
  124. data/lib/capybara/spec/session/within_spec.rb +41 -41
  125. data/lib/capybara/spec/spec_helper.rb +11 -9
  126. data/lib/capybara/spec/test_app.rb +18 -17
  127. data/lib/capybara/spec/views/form.erb +29 -31
  128. data/lib/capybara/spec/views/with_html.erb +2 -2
  129. data/lib/capybara/version.rb +1 -1
  130. data/spec/basic_node_spec.rb +23 -23
  131. data/spec/capybara_spec.rb +20 -20
  132. data/spec/css_splitter_spec.rb +7 -7
  133. data/spec/dsl_spec.rb +37 -32
  134. data/spec/filter_set_spec.rb +4 -4
  135. data/spec/fixtures/selenium_driver_rspec_failure.rb +1 -1
  136. data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
  137. data/spec/minitest_spec.rb +4 -4
  138. data/spec/minitest_spec_spec.rb +23 -23
  139. data/spec/per_session_config_spec.rb +5 -5
  140. data/spec/rack_test_spec.rb +44 -44
  141. data/spec/result_spec.rb +14 -14
  142. data/spec/rspec/features_spec.rb +13 -13
  143. data/spec/rspec/scenarios_spec.rb +4 -4
  144. data/spec/rspec/shared_spec_matchers.rb +282 -281
  145. data/spec/rspec/views_spec.rb +3 -3
  146. data/spec/rspec_matchers_spec.rb +10 -10
  147. data/spec/rspec_spec.rb +29 -29
  148. data/spec/selector_spec.rb +64 -64
  149. data/spec/selenium_spec_chrome.rb +14 -22
  150. data/spec/selenium_spec_chrome_remote.rb +28 -8
  151. data/spec/selenium_spec_edge.rb +9 -4
  152. data/spec/selenium_spec_firefox_remote.rb +87 -0
  153. data/spec/selenium_spec_ie.rb +9 -4
  154. data/spec/selenium_spec_marionette.rb +42 -18
  155. data/spec/server_spec.rb +29 -27
  156. data/spec/session_spec.rb +17 -17
  157. data/spec/shared_selenium_session.rb +70 -52
  158. data/spec/spec_helper.rb +1 -1
  159. metadata +4 -2
@@ -7,9 +7,14 @@ class TestClass
7
7
  include Capybara::DSL
8
8
  end
9
9
 
10
- Capybara::SpecHelper.run_specs TestClass.new, "DSL", capybara_skip: %i[
10
+ Capybara::SpecHelper.run_specs TestClass.new, 'DSL', capybara_skip: %i[
11
11
  js modals screenshot frames windows send_keys server hover about_scheme psc download css
12
- ]
12
+ ] do |example|
13
+ case example.metadata[:full_description]
14
+ when /doesn't raise exception on a nil current_url$/
15
+ skip 'Only makes sense when there is a real driver'
16
+ end
17
+ end
13
18
 
14
19
  RSpec.describe Capybara::DSL do
15
20
  after do
@@ -21,42 +26,42 @@ RSpec.describe Capybara::DSL do
21
26
  end
22
27
 
23
28
  describe '#default_driver' do
24
- it "should default to rack_test" do
29
+ it 'should default to rack_test' do
25
30
  expect(Capybara.default_driver).to eq(:rack_test)
26
31
  end
27
32
 
28
- it "should be changeable" do
33
+ it 'should be changeable' do
29
34
  Capybara.default_driver = :culerity
30
35
  expect(Capybara.default_driver).to eq(:culerity)
31
36
  end
32
37
  end
33
38
 
34
39
  describe '#current_driver' do
35
- it "should default to the default driver" do
40
+ it 'should default to the default driver' do
36
41
  expect(Capybara.current_driver).to eq(:rack_test)
37
42
  Capybara.default_driver = :culerity
38
43
  expect(Capybara.current_driver).to eq(:culerity)
39
44
  end
40
45
 
41
- it "should be changeable" do
46
+ it 'should be changeable' do
42
47
  Capybara.current_driver = :culerity
43
48
  expect(Capybara.current_driver).to eq(:culerity)
44
49
  end
45
50
  end
46
51
 
47
52
  describe '#javascript_driver' do
48
- it "should default to selenium" do
53
+ it 'should default to selenium' do
49
54
  expect(Capybara.javascript_driver).to eq(:selenium)
50
55
  end
51
56
 
52
- it "should be changeable" do
57
+ it 'should be changeable' do
53
58
  Capybara.javascript_driver = :culerity
54
59
  expect(Capybara.javascript_driver).to eq(:culerity)
55
60
  end
56
61
  end
57
62
 
58
63
  describe '#use_default_driver' do
59
- it "should restore the default driver" do
64
+ it 'should restore the default driver' do
60
65
  Capybara.current_driver = :culerity
61
66
  Capybara.use_default_driver
62
67
  expect(Capybara.current_driver).to eq(:rack_test)
@@ -84,8 +89,8 @@ RSpec.describe Capybara::DSL do
84
89
  it 'should reset the driver even if an exception occurs' do
85
90
  driver_before_block = Capybara.current_driver
86
91
  begin
87
- Capybara.using_driver(:selenium) { raise "ohnoes!" }
88
- rescue Exception # rubocop:disable Lint/RescueException
92
+ Capybara.using_driver(:selenium) { raise 'ohnoes!' }
93
+ rescue Exception # rubocop:disable Lint/RescueException,Lint/HandleExceptions
89
94
  end
90
95
  expect(Capybara.current_driver).to eq(driver_before_block)
91
96
  end
@@ -117,7 +122,7 @@ RSpec.describe Capybara::DSL do
117
122
  Capybara.default_max_wait_time = @previous_wait_time
118
123
  end
119
124
 
120
- it "should switch the wait time and switch it back" do
125
+ it 'should switch the wait time and switch it back' do
121
126
  in_block = nil
122
127
  Capybara.using_wait_time 6 do
123
128
  in_block = Capybara.default_max_wait_time
@@ -126,40 +131,40 @@ RSpec.describe Capybara::DSL do
126
131
  expect(Capybara.default_max_wait_time).to eq(@previous_wait_time)
127
132
  end
128
133
 
129
- it "should ensure wait time is reset" do
134
+ it 'should ensure wait time is reset' do
130
135
  expect do
131
136
  Capybara.using_wait_time 6 do
132
- raise "hell"
137
+ raise 'hell'
133
138
  end
134
- end.to raise_error(RuntimeError, "hell")
139
+ end.to raise_error(RuntimeError, 'hell')
135
140
  expect(Capybara.default_max_wait_time).to eq(@previous_wait_time)
136
141
  end
137
142
  end
138
143
 
139
144
  describe '#app' do
140
- it "should be changeable" do
141
- Capybara.app = "foobar"
145
+ it 'should be changeable' do
146
+ Capybara.app = 'foobar'
142
147
  expect(Capybara.app).to eq('foobar')
143
148
  end
144
149
  end
145
150
 
146
151
  describe '#current_session' do
147
- it "should choose a session object of the current driver type" do
152
+ it 'should choose a session object of the current driver type' do
148
153
  expect(Capybara.current_session).to be_a(Capybara::Session)
149
154
  end
150
155
 
151
- it "should use #app as the application" do
156
+ it 'should use #app as the application' do
152
157
  Capybara.app = proc {}
153
158
  expect(Capybara.current_session.app).to eq(Capybara.app)
154
159
  end
155
160
 
156
- it "should change with the current driver" do
161
+ it 'should change with the current driver' do
157
162
  expect(Capybara.current_session.mode).to eq(:rack_test)
158
163
  Capybara.current_driver = :selenium
159
164
  expect(Capybara.current_session.mode).to eq(:selenium)
160
165
  end
161
166
 
162
- it "should be persistent even across driver changes" do
167
+ it 'should be persistent even across driver changes' do
163
168
  object_id = Capybara.current_session.object_id
164
169
  expect(Capybara.current_session.object_id).to eq(object_id)
165
170
  Capybara.current_driver = :selenium
@@ -170,7 +175,7 @@ RSpec.describe Capybara::DSL do
170
175
  expect(Capybara.current_session.object_id).to eq(object_id)
171
176
  end
172
177
 
173
- it "should change when changing application" do
178
+ it 'should change when changing application' do
174
179
  object_id = Capybara.current_session.object_id
175
180
  expect(Capybara.current_session.object_id).to eq(object_id)
176
181
  Capybara.app = proc {}
@@ -178,7 +183,7 @@ RSpec.describe Capybara::DSL do
178
183
  expect(Capybara.current_session.app).to eq(Capybara.app)
179
184
  end
180
185
 
181
- it "should change when the session name changes" do
186
+ it 'should change when the session name changes' do
182
187
  object_id = Capybara.current_session.object_id
183
188
  Capybara.session_name = :administrator
184
189
  expect(Capybara.session_name).to eq(:administrator)
@@ -189,8 +194,8 @@ RSpec.describe Capybara::DSL do
189
194
  end
190
195
  end
191
196
 
192
- describe "#using_session" do
193
- it "should change the session name for the duration of the block" do
197
+ describe '#using_session' do
198
+ it 'should change the session name for the duration of the block' do
194
199
  expect(Capybara.session_name).to eq(:default)
195
200
  Capybara.using_session(:administrator) do
196
201
  expect(Capybara.session_name).to eq(:administrator)
@@ -198,23 +203,23 @@ RSpec.describe Capybara::DSL do
198
203
  expect(Capybara.session_name).to eq(:default)
199
204
  end
200
205
 
201
- it "should reset the session to the default, even if an exception occurs" do
206
+ it 'should reset the session to the default, even if an exception occurs' do
202
207
  begin
203
208
  Capybara.using_session(:raise) do
204
209
  raise
205
210
  end
206
- rescue Exception # rubocop:disable Lint/RescueException
211
+ rescue Exception # rubocop:disable Lint/RescueException,Lint/HandleExceptions
207
212
  end
208
213
  expect(Capybara.session_name).to eq(:default)
209
214
  end
210
215
 
211
- it "should yield the passed block" do
216
+ it 'should yield the passed block' do
212
217
  called = false
213
218
  Capybara.using_session(:administrator) { called = true }
214
219
  expect(called).to eq(true)
215
220
  end
216
221
 
217
- it "should be nestable" do
222
+ it 'should be nestable' do
218
223
  Capybara.using_session(:outer) do
219
224
  expect(Capybara.session_name).to eq(:outer)
220
225
  Capybara.using_session(:inner) do
@@ -226,8 +231,8 @@ RSpec.describe Capybara::DSL do
226
231
  end
227
232
  end
228
233
 
229
- describe "#session_name" do
230
- it "should default to :default" do
234
+ describe '#session_name' do
235
+ it 'should default to :default' do
231
236
  expect(Capybara.session_name).to eq(:default)
232
237
  end
233
238
  end
@@ -237,7 +242,7 @@ RSpec.describe Capybara::DSL do
237
242
  @session = Class.new { include Capybara::DSL }.new
238
243
  end
239
244
 
240
- it "should be possible to include it in another class" do
245
+ it 'should be possible to include it in another class' do
241
246
  @session.visit('/with_html')
242
247
  @session.click_link('ullamco')
243
248
  expect(@session.body).to include('Another World')
@@ -7,7 +7,7 @@ RSpec.describe Capybara::Selector::FilterSet do
7
7
  Capybara::Selector::FilterSet.remove(:test)
8
8
  end
9
9
 
10
- it "allows node filters" do
10
+ it 'allows node filters' do
11
11
  fs = Capybara::Selector::FilterSet.add(:test) do
12
12
  node_filter(:node_test, :boolean) { |_node, _value| true }
13
13
  expression_filter(:expression_test, :boolean) { |_expr, _value| true }
@@ -17,7 +17,7 @@ RSpec.describe Capybara::Selector::FilterSet do
17
17
  expect(fs.node_filters.keys).not_to include(:expression_test)
18
18
  end
19
19
 
20
- it "allows expression filters" do
20
+ it 'allows expression filters' do
21
21
  fs = Capybara::Selector::FilterSet.add(:test) do
22
22
  node_filter(:node_test, :boolean) { |_node, _value| true }
23
23
  expression_filter(:expression_test, :boolean) { |_expr, _value| true }
@@ -27,7 +27,7 @@ RSpec.describe Capybara::Selector::FilterSet do
27
27
  expect(fs.expression_filters.keys).not_to include(:node_test)
28
28
  end
29
29
 
30
- it "allows node filter and expression filter with the same name" do
30
+ it 'allows node filter and expression filter with the same name' do
31
31
  fs = Capybara::Selector::FilterSet.add(:test) do
32
32
  node_filter(:test, :boolean) { |_node, _value| true }
33
33
  expression_filter(:test, :boolean) { |_expr, _value| true }
@@ -36,7 +36,7 @@ RSpec.describe Capybara::Selector::FilterSet do
36
36
  expect(fs.expression_filters[:test]).not_to eq fs.node_filters[:test]
37
37
  end
38
38
 
39
- it "allows `filter` as an alias of `node_filter`" do
39
+ it 'allows `filter` as an alias of `node_filter`' do
40
40
  fs = Capybara::Selector::FilterSet.add(:test) do
41
41
  filter(:node_test, :boolean) { |_node, _value| true }
42
42
  end
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
  require 'selenium-webdriver'
5
5
 
6
6
  RSpec.describe Capybara::Selenium::Driver do
7
- it "should exit with a non-zero exit status" do
7
+ it 'should exit with a non-zero exit status' do
8
8
  options = { browser: (ENV['SELENIUM_BROWSER'] || :firefox).to_sym }
9
9
  browser = Capybara::Selenium::Driver.new(TestApp, options).browser
10
10
  expect(browser).to be_truthy
@@ -4,7 +4,7 @@ require 'spec_helper'
4
4
  require 'selenium-webdriver'
5
5
 
6
6
  RSpec.describe Capybara::Selenium::Driver do
7
- it "should exit with a zero exit status" do
7
+ it 'should exit with a zero exit status' do
8
8
  options = { browser: (ENV['SELENIUM_BROWSER'] || :firefox).to_sym }
9
9
  browser = Capybara::Selenium::Driver.new(TestApp, options).browser
10
10
  expect(browser).to be_truthy
@@ -36,9 +36,9 @@ class MinitestTest < Minitest::Test
36
36
 
37
37
  def test_assert_xpath
38
38
  assert_xpath('.//select[@id="form_title"]')
39
- assert_xpath('.//select', count: 1) { |el| el[:id] == "form_title" }
39
+ assert_xpath('.//select', count: 1) { |el| el[:id] == 'form_title' }
40
40
  assert_no_xpath('.//select[@id="not_form_title"]')
41
- assert_no_xpath('.//select') { |el| el[:id] == "not_form_title" }
41
+ assert_no_xpath('.//select') { |el| el[:id] == 'not_form_title' }
42
42
  refute_xpath('.//select[@id="not_form_title"]')
43
43
  end
44
44
 
@@ -126,12 +126,12 @@ RSpec.describe 'capybara/minitest' do
126
126
  Capybara.app = TestApp
127
127
  end
128
128
 
129
- it "should support minitest" do
129
+ it 'should support minitest' do
130
130
  output = StringIO.new
131
131
  reporter = Minitest::SummaryReporter.new(output)
132
132
  reporter.start
133
133
  MinitestTest.run reporter, {}
134
134
  reporter.report
135
- expect(output.string).to include("18 runs, 44 assertions, 0 failures, 0 errors, 1 skips")
135
+ expect(output.string).to include('18 runs, 44 assertions, 0 failures, 0 errors, 1 skips')
136
136
  end
137
137
  end
@@ -16,7 +16,7 @@ class MinitestSpecTest < Minitest::Spec
16
16
  Capybara.reset_sessions!
17
17
  end
18
18
 
19
- it "supports text expectations" do
19
+ it 'supports text expectations' do
20
20
  page.must_have_text('Form', minimum: 1)
21
21
  page.wont_have_text('Not a form')
22
22
  form = find(:css, 'form', text: 'Title')
@@ -24,28 +24,28 @@ class MinitestSpecTest < Minitest::Spec
24
24
  form.wont_have_text('Some other email')
25
25
  end
26
26
 
27
- it "supports current_path expectations" do
27
+ it 'supports current_path expectations' do
28
28
  page.must_have_current_path('/form')
29
29
  page.wont_have_current_path('/form2')
30
30
  end
31
31
 
32
- it "supports title expectations" do
32
+ it 'supports title expectations' do
33
33
  visit('/with_title')
34
34
  page.must_have_title('Test Title')
35
35
  page.wont_have_title('Not the title')
36
36
  end
37
37
 
38
- it "supports xpath expectations" do
38
+ it 'supports xpath expectations' do
39
39
  page.must_have_xpath('.//input[@id="customer_email"]')
40
40
  page.wont_have_xpath('.//select[@id="not_form_title"]')
41
- page.wont_have_xpath('.//input[@id="customer_email"]') { |el| el[:id] == "not_customer_email" }
41
+ page.wont_have_xpath('.//input[@id="customer_email"]') { |el| el[:id] == 'not_customer_email' }
42
42
  select = find(:select, 'form_title')
43
43
  select.must_have_xpath('.//option[@class="title"]')
44
44
  select.must_have_xpath('.//option', count: 1) { |option| option[:class] != 'title' && !option.disabled? }
45
45
  select.wont_have_xpath('.//input[@id="customer_email"]')
46
46
  end
47
47
 
48
- it "support css expectations" do
48
+ it 'support css expectations' do
49
49
  page.must_have_css('input#customer_email')
50
50
  page.wont_have_css('select#not_form_title')
51
51
  el = find(:select, 'form_title')
@@ -53,71 +53,71 @@ class MinitestSpecTest < Minitest::Spec
53
53
  el.wont_have_css('input#customer_email')
54
54
  end
55
55
 
56
- it "supports link expectations" do
56
+ it 'supports link expectations' do
57
57
  visit('/with_html')
58
58
  page.must_have_link('A link')
59
59
  page.wont_have_link('Not on page')
60
60
  end
61
61
 
62
- it "supports button expectations" do
62
+ it 'supports button expectations' do
63
63
  page.must_have_button('fresh_btn')
64
64
  page.wont_have_button('not_btn')
65
65
  end
66
66
 
67
- it "supports field expectations" do
67
+ it 'supports field expectations' do
68
68
  page.must_have_field('customer_email')
69
69
  page.wont_have_field('not_on_the_form')
70
70
  end
71
71
 
72
- it "supports select expectations" do
72
+ it 'supports select expectations' do
73
73
  page.must_have_select('form_title')
74
74
  page.wont_have_select('not_form_title')
75
75
  end
76
76
 
77
- it "supports checked_field expectations" do
77
+ it 'supports checked_field expectations' do
78
78
  page.must_have_checked_field('form_pets_dog')
79
79
  page.wont_have_checked_field('form_pets_cat')
80
80
  end
81
81
 
82
- it "supports unchecked_field expectations" do
82
+ it 'supports unchecked_field expectations' do
83
83
  page.must_have_unchecked_field('form_pets_cat')
84
84
  page.wont_have_unchecked_field('form_pets_dog')
85
85
  end
86
86
 
87
- it "supports table expectations" do
87
+ it 'supports table expectations' do
88
88
  visit('/tables')
89
89
  page.must_have_table('agent_table')
90
90
  page.wont_have_table('not_on_form')
91
91
  end
92
92
 
93
- it "supports all_of_selectors expectations" do
93
+ it 'supports all_of_selectors expectations' do
94
94
  page.must_have_all_of_selectors(:css, 'select#form_other_title', 'input#form_last_name')
95
95
  end
96
96
 
97
- it "supports none_of_selectors expectations" do
97
+ it 'supports none_of_selectors expectations' do
98
98
  page.must_have_none_of_selectors(:css, 'input#not_on_page', 'input#also_not_on_page')
99
99
  end
100
100
 
101
- it "supports match_selector expectations" do
101
+ it 'supports match_selector expectations' do
102
102
  find(:field, 'customer_email').must_match_selector(:field, 'customer_email')
103
103
  find(:select, 'form_title').wont_match_selector(:field, 'customer_email')
104
104
  end
105
105
 
106
- it "supports match_css expectations" do
106
+ it 'supports match_css expectations' do
107
107
  find(:select, 'form_title').must_match_css('select#form_title')
108
108
  find(:select, 'form_title').wont_match_css('select#form_other_title')
109
109
  end
110
110
 
111
- it "supports match_xpath expectations" do
111
+ it 'supports match_xpath expectations' do
112
112
  find(:select, 'form_title').must_match_xpath('.//select[@id="form_title"]')
113
113
  find(:select, 'form_title').wont_match_xpath('.//select[@id="not_on_page"]')
114
114
  end
115
115
 
116
- it "handles failures" do
116
+ it 'handles failures' do
117
117
  page.must_have_select('non_existing_form_title')
118
118
  end
119
119
 
120
- it "supports style expectations" do
120
+ it 'supports style expectations' do
121
121
  skip "Rack test doesn't support style" if Capybara.current_driver == :rack_test
122
122
  visit('/with_html')
123
123
  find(:css, '#second').must_have_style('display' => 'inline')
@@ -130,14 +130,14 @@ RSpec.describe 'capybara/minitest/spec' do
130
130
  Capybara.app = TestApp
131
131
  end
132
132
 
133
- it "should support minitest spec" do
133
+ it 'should support minitest spec' do
134
134
  output = StringIO.new
135
135
  reporter = Minitest::SummaryReporter.new(output)
136
136
  reporter.start
137
137
  MinitestSpecTest.run reporter, {}
138
138
  reporter.report
139
- expect(output.string).to include("19 runs, 41 assertions, 1 failures, 0 errors, 1 skips")
139
+ expect(output.string).to include('19 runs, 41 assertions, 1 failures, 0 errors, 1 skips')
140
140
  # Make sure error messages are displayed
141
- expect(output.string).to include('expected to find visible select box "non_existing_form_title" that is not disabled but there were no matches')
141
+ expect(output.string).to include('expected to find select box "non_existing_form_title" but there were no matches')
142
142
  end
143
143
  end
@@ -4,8 +4,8 @@ require 'spec_helper'
4
4
  require 'capybara/dsl'
5
5
 
6
6
  RSpec.describe Capybara::SessionConfig do
7
- describe "threadsafe" do
8
- it "defaults to global session options" do
7
+ describe 'threadsafe' do
8
+ it 'defaults to global session options' do
9
9
  Capybara.threadsafe = true
10
10
  session = Capybara::Session.new(:rack_test, TestApp)
11
11
  %i[default_host app_host always_include_port run_server
@@ -19,7 +19,7 @@ RSpec.describe Capybara::SessionConfig do
19
19
 
20
20
  it "doesn't change global session when changed" do
21
21
  Capybara.threadsafe = true
22
- host = "http://my.example.com"
22
+ host = 'http://my.example.com'
23
23
  session = Capybara::Session.new(:rack_test, TestApp) do |config|
24
24
  config.default_host = host
25
25
  config.automatic_label_click = !config.automatic_label_click
@@ -35,7 +35,7 @@ RSpec.describe Capybara::SessionConfig do
35
35
  Capybara.threadsafe = false
36
36
  expect do
37
37
  Capybara::Session.new(:rack_test, TestApp) { |config| }
38
- end.to raise_error "A configuration block is only accepted when Capybara.threadsafe == true"
38
+ end.to raise_error 'A configuration block is only accepted when Capybara.threadsafe == true'
39
39
  end
40
40
 
41
41
  it "doesn't allow session config when false" do
@@ -49,7 +49,7 @@ RSpec.describe Capybara::SessionConfig do
49
49
  end.to raise_error(/Session configuration is only supported when Capybara.threadsafe == true/)
50
50
  end
51
51
 
52
- it "uses the config from the session" do
52
+ it 'uses the config from the session' do
53
53
  Capybara.threadsafe = true
54
54
  session = Capybara::Session.new(:rack_test, TestApp) do |config|
55
55
  config.default_selector = :link