capybara 2.9.2 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +10 -1
  3. data/README.md +34 -27
  4. data/lib/capybara.rb +2 -2
  5. data/lib/capybara/node/actions.rb +3 -3
  6. data/lib/capybara/node/base.rb +2 -2
  7. data/lib/capybara/node/element.rb +1 -1
  8. data/lib/capybara/node/finders.rb +37 -32
  9. data/lib/capybara/node/matchers.rb +187 -171
  10. data/lib/capybara/queries/selector_query.rb +11 -14
  11. data/lib/capybara/rack_test/driver.rb +3 -3
  12. data/lib/capybara/rails.rb +1 -1
  13. data/lib/capybara/rspec/features.rb +1 -1
  14. data/lib/capybara/rspec/matchers.rb +31 -22
  15. data/lib/capybara/selector.rb +2 -2
  16. data/lib/capybara/selector/selector.rb +22 -0
  17. data/lib/capybara/session.rb +4 -4
  18. data/lib/capybara/spec/session/accept_alert_spec.rb +4 -4
  19. data/lib/capybara/spec/session/accept_confirm_spec.rb +1 -1
  20. data/lib/capybara/spec/session/accept_prompt_spec.rb +5 -5
  21. data/lib/capybara/spec/session/all_spec.rb +27 -27
  22. data/lib/capybara/spec/session/assert_current_path.rb +2 -2
  23. data/lib/capybara/spec/session/assert_selector.rb +28 -28
  24. data/lib/capybara/spec/session/assert_text.rb +20 -20
  25. data/lib/capybara/spec/session/assert_title.rb +2 -2
  26. data/lib/capybara/spec/session/attach_file_spec.rb +2 -2
  27. data/lib/capybara/spec/session/check_spec.rb +5 -5
  28. data/lib/capybara/spec/session/choose_spec.rb +4 -4
  29. data/lib/capybara/spec/session/click_button_spec.rb +18 -5
  30. data/lib/capybara/spec/session/click_link_or_button_spec.rb +6 -6
  31. data/lib/capybara/spec/session/click_link_spec.rb +13 -13
  32. data/lib/capybara/spec/session/current_url_spec.rb +2 -2
  33. data/lib/capybara/spec/session/dismiss_confirm_spec.rb +1 -1
  34. data/lib/capybara/spec/session/dismiss_prompt_spec.rb +1 -1
  35. data/lib/capybara/spec/session/element/matches_selector_spec.rb +15 -8
  36. data/lib/capybara/spec/session/evaluate_script_spec.rb +1 -1
  37. data/lib/capybara/spec/session/execute_script_spec.rb +2 -2
  38. data/lib/capybara/spec/session/fill_in_spec.rb +30 -30
  39. data/lib/capybara/spec/session/find_button_spec.rb +5 -5
  40. data/lib/capybara/spec/session/find_by_id_spec.rb +2 -2
  41. data/lib/capybara/spec/session/find_field_spec.rb +11 -7
  42. data/lib/capybara/spec/session/find_link_spec.rb +2 -2
  43. data/lib/capybara/spec/session/find_spec.rb +52 -48
  44. data/lib/capybara/spec/session/first_spec.rb +9 -9
  45. data/lib/capybara/spec/session/go_back_spec.rb +1 -1
  46. data/lib/capybara/spec/session/go_forward_spec.rb +1 -1
  47. data/lib/capybara/spec/session/has_button_spec.rb +12 -12
  48. data/lib/capybara/spec/session/has_css_spec.rb +73 -73
  49. data/lib/capybara/spec/session/has_current_path_spec.rb +2 -2
  50. data/lib/capybara/spec/session/has_field_spec.rb +78 -68
  51. data/lib/capybara/spec/session/has_link_spec.rb +8 -8
  52. data/lib/capybara/spec/session/has_select_spec.rb +70 -61
  53. data/lib/capybara/spec/session/has_selector_spec.rb +28 -28
  54. data/lib/capybara/spec/session/has_text_spec.rb +6 -6
  55. data/lib/capybara/spec/session/has_title_spec.rb +2 -2
  56. data/lib/capybara/spec/session/has_xpath_spec.rb +26 -26
  57. data/lib/capybara/spec/session/headers.rb +1 -1
  58. data/lib/capybara/spec/session/html_spec.rb +3 -3
  59. data/lib/capybara/spec/session/node_spec.rb +15 -15
  60. data/lib/capybara/spec/session/reset_session_spec.rb +4 -4
  61. data/lib/capybara/spec/session/response_code.rb +1 -1
  62. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +3 -3
  63. data/lib/capybara/spec/session/screenshot_spec.rb +1 -1
  64. data/lib/capybara/spec/session/select_spec.rb +30 -30
  65. data/lib/capybara/spec/session/uncheck_spec.rb +2 -2
  66. data/lib/capybara/spec/session/unselect_spec.rb +14 -14
  67. data/lib/capybara/spec/session/visit_spec.rb +2 -2
  68. data/lib/capybara/spec/session/within_frame_spec.rb +2 -2
  69. data/lib/capybara/spec/session/within_spec.rb +6 -6
  70. data/lib/capybara/spec/spec_helper.rb +1 -1
  71. data/lib/capybara/spec/test_app.rb +1 -1
  72. data/lib/capybara/spec/views/form.erb +1 -0
  73. data/lib/capybara/version.rb +1 -1
  74. data/spec/basic_node_spec.rb +5 -5
  75. data/spec/capybara_spec.rb +1 -1
  76. data/spec/dsl_spec.rb +1 -1
  77. data/spec/rack_test_spec.rb +7 -7
  78. data/spec/rspec/matchers_spec.rb +6 -6
  79. data/spec/rspec_spec.rb +1 -1
  80. data/spec/selector_spec.rb +13 -0
  81. data/spec/selenium_firefox_spec.rb +1 -1
  82. data/spec/selenium_spec_chrome.rb +1 -1
  83. data/spec/shared_selenium_session.rb +10 -10
  84. metadata +2 -2
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  Capybara::SpecHelper.spec '#response_headers' do
3
- it "should return response headers", :requires => [:response_headers] do
3
+ it "should return response headers", requires: [:response_headers] do
4
4
  @session.visit('/with_simple_html')
5
5
  expect(@session.response_headers['Content-Type']).to match %r(text/html)
6
6
  end
@@ -5,7 +5,7 @@ Capybara::SpecHelper.spec '#html' do
5
5
  expect(@session.html).to include('Hello world!')
6
6
  end
7
7
 
8
- it "should return the current state of the page", :requires => [:js] do
8
+ it "should return the current state of the page", requires: [:js] do
9
9
  @session.visit('/with_js')
10
10
  expect(@session.html).to include('I changed it')
11
11
  expect(@session.html).not_to include('This is text')
@@ -18,7 +18,7 @@ Capybara::SpecHelper.spec '#source' do
18
18
  expect(@session.source).to include('Hello world!')
19
19
  end
20
20
 
21
- it "should return the current state of the page", :requires => [:js] do
21
+ it "should return the current state of the page", requires: [:js] do
22
22
  @session.visit('/with_js')
23
23
  expect(@session.source).to include('I changed it')
24
24
  expect(@session.source).not_to include('This is text')
@@ -31,7 +31,7 @@ Capybara::SpecHelper.spec '#body' do
31
31
  expect(@session.body).to include('Hello world!')
32
32
  end
33
33
 
34
- it "should return the current state of the page", :requires => [:js] do
34
+ it "should return the current state of the page", requires: [:js] do
35
35
  @session.visit('/with_js')
36
36
  expect(@session.body).to include('I changed it')
37
37
  expect(@session.body).not_to include('This is text')
@@ -10,7 +10,7 @@ Capybara::SpecHelper.spec "node" do
10
10
  @form = @session.find(:css, '#get-form')
11
11
  expect(@form).to have_field('Middle Name')
12
12
  expect(@form).to have_no_field('Languages')
13
- @form.fill_in('Middle Name', :with => 'Monkey')
13
+ @form.fill_in('Middle Name', with: 'Monkey')
14
14
  @form.click_button('med')
15
15
  expect(extract_results(@session)['middle_name']).to eq('Monkey')
16
16
  end
@@ -96,7 +96,7 @@ Capybara::SpecHelper.spec "node" do
96
96
  expect(@session.first('//input').value).to eq('gorilla')
97
97
  end
98
98
 
99
- it "should fill the field even if the caret was not at the end", :requires => [:js] do
99
+ it "should fill the field even if the caret was not at the end", requires: [:js] do
100
100
  @session.execute_script("var el = document.getElementById('test_field'); el.focus(); el.setSelectionRange(0, 0);")
101
101
  @session.first('//input').set('')
102
102
  expect(@session.first('//input').value).to eq('')
@@ -122,19 +122,19 @@ Capybara::SpecHelper.spec "node" do
122
122
  expect(@session.first('//textarea[@readonly]').set('changed')).to raise_error(Capybara::ReadOnlyElementError)
123
123
  end if Capybara::VERSION.to_f > 3.0
124
124
 
125
- it 'should allow me to change the contents of a contenteditable element', :requires => [:js] do
125
+ it 'should allow me to change the contents of a contenteditable element', requires: [:js] do
126
126
  @session.visit('/with_js')
127
127
  @session.find(:css,'#existing_content_editable').set('WYSIWYG')
128
128
  expect(@session.find(:css,'#existing_content_editable').text).to eq('WYSIWYG')
129
129
  end
130
130
 
131
- it 'should allow me to set the contents of a contenteditable element', :requires => [:js] do
131
+ it 'should allow me to set the contents of a contenteditable element', requires: [:js] do
132
132
  @session.visit('/with_js')
133
133
  @session.find(:css,'#blank_content_editable').set('WYSIWYG')
134
134
  expect(@session.find(:css,'#blank_content_editable').text).to eq('WYSIWYG')
135
135
  end
136
136
 
137
- it 'should allow me to change the contents of a contenteditable elements child', :requires => [:js] do
137
+ it 'should allow me to change the contents of a contenteditable elements child', requires: [:js] do
138
138
  pending "Selenium doesn't like editing nested contents"
139
139
  @session.visit('/with_js')
140
140
  @session.find(:css,'#existing_content_editable_child').set('WYSIWYG')
@@ -253,7 +253,7 @@ Capybara::SpecHelper.spec "node" do
253
253
  end
254
254
  end
255
255
 
256
- describe "#trigger", :requires => [:js, :trigger] do
256
+ describe "#trigger", requires: [:js, :trigger] do
257
257
  it "should allow triggering of custom JS events" do
258
258
  @session.visit('/with_js')
259
259
  @session.find(:css, '#with_focus_event').trigger(:focus)
@@ -261,7 +261,7 @@ Capybara::SpecHelper.spec "node" do
261
261
  end
262
262
  end
263
263
 
264
- describe '#drag_to', :requires => [:js, :drag] do
264
+ describe '#drag_to', requires: [:js, :drag] do
265
265
  it "should drag and drop an object" do
266
266
  @session.visit('/with_js')
267
267
  element = @session.find('//div[@id="drag"]')
@@ -271,12 +271,12 @@ Capybara::SpecHelper.spec "node" do
271
271
  end
272
272
  end
273
273
 
274
- describe '#hover', :requires => [:hover] do
274
+ describe '#hover', requires: [:hover] do
275
275
  it "should allow hovering on an element" do
276
276
  @session.visit('/with_hover')
277
- expect(@session.find(:css,'.hidden_until_hover', :visible => false)).not_to be_visible
277
+ expect(@session.find(:css,'.hidden_until_hover', visible: false)).not_to be_visible
278
278
  @session.find(:css,'.wrapper').hover
279
- expect(@session.find(:css, '.hidden_until_hover', :visible => false)).to be_visible
279
+ expect(@session.find(:css, '.hidden_until_hover', visible: false)).to be_visible
280
280
  end
281
281
  end
282
282
 
@@ -287,7 +287,7 @@ Capybara::SpecHelper.spec "node" do
287
287
  end
288
288
  end
289
289
 
290
- describe '#double_click', :requires => [:js] do
290
+ describe '#double_click', requires: [:js] do
291
291
  it "should double click an element" do
292
292
  @session.visit('/with_js')
293
293
  @session.find(:css, '#click-test').double_click
@@ -295,7 +295,7 @@ Capybara::SpecHelper.spec "node" do
295
295
  end
296
296
  end
297
297
 
298
- describe '#right_click', :requires => [:js] do
298
+ describe '#right_click', requires: [:js] do
299
299
  it "should right click an element" do
300
300
  @session.visit('/with_js')
301
301
  @session.find(:css, '#click-test').right_click
@@ -329,7 +329,7 @@ Capybara::SpecHelper.spec "node" do
329
329
  end
330
330
  end
331
331
 
332
- describe '#reload', :requires => [:js] do
332
+ describe '#reload', requires: [:js] do
333
333
  context "without automatic reload" do
334
334
  before { Capybara.automatic_reload = false }
335
335
  it "should reload the current context of the node" do
@@ -409,7 +409,7 @@ Capybara::SpecHelper.spec "node" do
409
409
 
410
410
  it "should reload nodes with options" do
411
411
  @session.visit('/with_js')
412
- node = @session.find(:css, 'em', :text => "reloaded")
412
+ node = @session.find(:css, 'em', text: "reloaded")
413
413
  @session.click_link('Reload!')
414
414
  sleep(1)
415
415
  expect(node.text).to eq('has been reloaded')
@@ -418,7 +418,7 @@ Capybara::SpecHelper.spec "node" do
418
418
  end
419
419
 
420
420
  context "when #synchronize raises server errors" do
421
- it "sets an explanatory exception as the cause of server exceptions", :requires => [:server, :js] do
421
+ it "sets an explanatory exception as the cause of server exceptions", requires: [:server, :js] do
422
422
  skip "This version of ruby doesn't support exception causes" unless Exception.instance_methods.include? :cause
423
423
  quietly { @session.visit("/error") }
424
424
  expect do
@@ -53,7 +53,7 @@ Capybara::SpecHelper.spec '#reset_session!' do
53
53
  expect(@session).to have_no_selector :xpath, "/html/body/*", wait: false
54
54
  end
55
55
 
56
- it "raises any standard errors caught inside the server", :requires => [:server] do
56
+ it "raises any standard errors caught inside the server", requires: [:server] do
57
57
  quietly { @session.visit("/error") }
58
58
  expect do
59
59
  @session.reset_session!
@@ -68,7 +68,7 @@ Capybara::SpecHelper.spec '#reset_session!' do
68
68
  Capybara.reuse_server = false
69
69
  end
70
70
 
71
- it "raises any standard errors caught inside the server during a second session", :requires => [:server] do
71
+ it "raises any standard errors caught inside the server during a second session", requires: [:server] do
72
72
  Capybara.using_driver(@session.mode) do
73
73
  Capybara.using_session(:another_session) do
74
74
  @another_session = Capybara.current_session
@@ -87,7 +87,7 @@ Capybara::SpecHelper.spec '#reset_session!' do
87
87
  end
88
88
  end
89
89
 
90
- it "raises configured errors caught inside the server", :requires => [:server] do
90
+ it "raises configured errors caught inside the server", requires: [:server] do
91
91
  prev_errors = Capybara.server_errors
92
92
 
93
93
  Capybara.server_errors = [LoadError]
@@ -104,7 +104,7 @@ Capybara::SpecHelper.spec '#reset_session!' do
104
104
  Capybara.server_errors = prev_errors
105
105
  end
106
106
 
107
- it "ignores server errors when `Capybara.raise_server_errors = false`", :requires => [:server] do
107
+ it "ignores server errors when `Capybara.raise_server_errors = false`", requires: [:server] do
108
108
  Capybara.raise_server_errors = false
109
109
  quietly { @session.visit("/error") }
110
110
  @session.reset_session!
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  Capybara::SpecHelper.spec '#status_code' do
3
- it "should return response codes", :requires => [:status_code] do
3
+ it "should return response codes", requires: [:status_code] do
4
4
  @session.visit('/with_simple_html')
5
5
  expect(@session.status_code).to eq(200)
6
6
  end
@@ -6,7 +6,7 @@ Capybara::SpecHelper.spec '#save_and_open_screenshot' do
6
6
  @session.visit '/'
7
7
  end
8
8
 
9
- it 'opens file from the default directory', :requires => [:screenshot] do
9
+ it 'opens file from the default directory', requires: [:screenshot] do
10
10
  expected_file_regex = %r{capybara-\d+\.png}
11
11
  allow(@session.driver).to receive(:save_screenshot)
12
12
  allow(Launchy).to receive(:open)
@@ -18,7 +18,7 @@ Capybara::SpecHelper.spec '#save_and_open_screenshot' do
18
18
  expect(Launchy).to have_received(:open).with(expected_file_regex)
19
19
  end
20
20
 
21
- it 'opens file from the provided directory', :requires => [:screenshot] do
21
+ it 'opens file from the provided directory', requires: [:screenshot] do
22
22
  custom_path = 'screenshots/1.png'
23
23
  allow(@session.driver).to receive(:save_screenshot)
24
24
  allow(Launchy).to receive(:open)
@@ -31,7 +31,7 @@ Capybara::SpecHelper.spec '#save_and_open_screenshot' do
31
31
  end
32
32
 
33
33
  context 'when launchy cannot be required' do
34
- it 'prints out a correct warning message', :requires => [:screenshot] do
34
+ it 'prints out a correct warning message', requires: [:screenshot] do
35
35
  file_path = File.join(Dir.tmpdir, 'test.png')
36
36
  allow(@session).to receive(:require).with('launchy').and_raise(LoadError)
37
37
  allow(@session).to receive(:warn)
@@ -8,7 +8,7 @@ Capybara::SpecHelper.spec "#save_screenshot" do
8
8
  @session.visit '/'
9
9
  end
10
10
 
11
- it "should generate PNG file", :requires => [:screenshot] do
11
+ it "should generate PNG file", requires: [:screenshot] do
12
12
  path = @session.save_screenshot image_path
13
13
 
14
14
  magic = File.read(image_path, 4)
@@ -9,30 +9,30 @@ Capybara::SpecHelper.spec "#select" do
9
9
  end
10
10
 
11
11
  it "should return value of the selected option" do
12
- @session.select("Miss", :from => 'Title')
12
+ @session.select("Miss", from: 'Title')
13
13
  expect(@session.find_field('Title').value).to eq('Miss')
14
14
  end
15
15
 
16
16
  it "should allow selecting options where there are inexact matches" do
17
- @session.select("Mr", :from => 'Title')
17
+ @session.select("Mr", from: 'Title')
18
18
  expect(@session.find_field('Title').value).to eq('Mr')
19
19
  end
20
20
 
21
21
  it "should allow selecting options where they are the only inexact match" do
22
- @session.select("Mis", :from => 'Title')
22
+ @session.select("Mis", from: 'Title')
23
23
  expect(@session.find_field('Title').value).to eq('Miss')
24
24
  end
25
25
 
26
26
  it "should not allow selecting options where they are the only inexact match if `Capybara.exact_options = true`" do
27
27
  Capybara.exact_options = true
28
28
  expect do
29
- @session.select("Mis", :from => 'Title')
29
+ @session.select("Mis", from: 'Title')
30
30
  end.to raise_error(Capybara::ElementNotFound)
31
31
  end
32
32
 
33
33
  it "should not allow selecting an option if the match is ambiguous" do
34
34
  expect do
35
- @session.select("M", :from => 'Title')
35
+ @session.select("M", from: 'Title')
36
36
  end.to raise_error(Capybara::Ambiguous)
37
37
  end
38
38
 
@@ -41,13 +41,13 @@ Capybara::SpecHelper.spec "#select" do
41
41
  end
42
42
 
43
43
  it "should select an option from a select box by id" do
44
- @session.select("Finish", :from => 'form_locale')
44
+ @session.select("Finish", from: 'form_locale')
45
45
  @session.click_button('awesome')
46
46
  expect(extract_results(@session)['locale']).to eq('fi')
47
47
  end
48
48
 
49
49
  it "should select an option from a select box by label" do
50
- @session.select("Finish", :from => 'Locale')
50
+ @session.select("Finish", from: 'Locale')
51
51
  @session.click_button('awesome')
52
52
  expect(extract_results(@session)['locale']).to eq('fi')
53
53
  end
@@ -59,13 +59,13 @@ Capybara::SpecHelper.spec "#select" do
59
59
  end
60
60
 
61
61
  it "should escape quotes" do
62
- @session.select("John's made-up language", :from => 'Locale')
62
+ @session.select("John's made-up language", from: 'Locale')
63
63
  @session.click_button('awesome')
64
64
  expect(extract_results(@session)['locale']).to eq('jo')
65
65
  end
66
66
 
67
67
  it "should obey from" do
68
- @session.select("Miss", :from => "Other title")
68
+ @session.select("Miss", from: "Other title")
69
69
  @session.click_button('awesome')
70
70
  results = extract_results(@session)
71
71
  expect(results['other_title']).to eq("Miss")
@@ -73,13 +73,13 @@ Capybara::SpecHelper.spec "#select" do
73
73
  end
74
74
 
75
75
  it "show match labels with preceding or trailing whitespace" do
76
- @session.select("Lojban", :from => 'Locale')
76
+ @session.select("Lojban", from: 'Locale')
77
77
  @session.click_button('awesome')
78
78
  expect(extract_results(@session)['locale']).to eq('jbo')
79
79
  end
80
80
 
81
81
  it "casts to string" do
82
- @session.select(:"Miss", :from => :'Title')
82
+ @session.select(:"Miss", from: :'Title')
83
83
  expect(@session.find_field('Title').value).to eq('Miss')
84
84
  end
85
85
 
@@ -87,7 +87,7 @@ Capybara::SpecHelper.spec "#select" do
87
87
  it "should raise an error" do
88
88
  msg = "Unable to find select box \"does not exist\""
89
89
  expect do
90
- @session.select('foo', :from => 'does not exist')
90
+ @session.select('foo', from: 'does not exist')
91
91
  end.to raise_error(Capybara::ElementNotFound, msg)
92
92
  end
93
93
  end
@@ -96,7 +96,7 @@ Capybara::SpecHelper.spec "#select" do
96
96
  it "should raise an error" do
97
97
  msg = "Unable to find option \"Does not Exist\""
98
98
  expect do
99
- @session.select('Does not Exist', :from => 'form_locale')
99
+ @session.select('Does not Exist', from: 'form_locale')
100
100
  end.to raise_error(Capybara::ElementNotFound, msg)
101
101
  end
102
102
  end
@@ -104,20 +104,20 @@ Capybara::SpecHelper.spec "#select" do
104
104
  context "on a disabled select" do
105
105
  it "should raise an error" do
106
106
  expect do
107
- @session.select('Should not see me', :from => 'Disabled Select')
107
+ @session.select('Should not see me', from: 'Disabled Select')
108
108
  end.to raise_error(Capybara::ElementNotFound)
109
109
  end
110
110
  end
111
111
 
112
112
  context "on a disabled option" do
113
113
  it "should not select" do
114
- @session.select('Other', :from => 'form_title')
114
+ @session.select('Other', from: 'form_title')
115
115
  expect(@session.find_field('form_title').value).not_to eq 'Other'
116
116
  end
117
117
 
118
118
  it "should warn" do
119
119
  expect_any_instance_of(Capybara::Node::Element).to receive(:warn).once
120
- @session.select('Other', :from => 'form_title')
120
+ @session.select('Other', from: 'form_title')
121
121
  end
122
122
  end
123
123
 
@@ -127,28 +127,28 @@ Capybara::SpecHelper.spec "#select" do
127
127
  end
128
128
 
129
129
  it "should return value of the selected options" do
130
- @session.select("Ruby", :from => 'Language')
131
- @session.select("Javascript", :from => 'Language')
130
+ @session.select("Ruby", from: 'Language')
131
+ @session.select("Javascript", from: 'Language')
132
132
  expect(@session.find_field('Language').value).to include('Ruby', 'Javascript')
133
133
  end
134
134
 
135
135
  it "should select one option" do
136
- @session.select("Ruby", :from => 'Language')
136
+ @session.select("Ruby", from: 'Language')
137
137
  @session.click_button('awesome')
138
138
  expect(extract_results(@session)['languages']).to eq(['Ruby'])
139
139
  end
140
140
 
141
141
  it "should select multiple options" do
142
- @session.select("Ruby", :from => 'Language')
143
- @session.select("Javascript", :from => 'Language')
142
+ @session.select("Ruby", from: 'Language')
143
+ @session.select("Javascript", from: 'Language')
144
144
  @session.click_button('awesome')
145
145
  expect(extract_results(@session)['languages']).to include('Ruby', 'Javascript')
146
146
  end
147
147
 
148
148
  it "should remain selected if already selected" do
149
- @session.select("Ruby", :from => 'Language')
150
- @session.select("Javascript", :from => 'Language')
151
- @session.select("Ruby", :from => 'Language')
149
+ @session.select("Ruby", from: 'Language')
150
+ @session.select("Javascript", from: 'Language')
151
+ @session.select("Ruby", from: 'Language')
152
152
  @session.click_button('awesome')
153
153
  expect(extract_results(@session)['languages']).to include('Ruby', 'Javascript')
154
154
  end
@@ -161,19 +161,19 @@ Capybara::SpecHelper.spec "#select" do
161
161
  context "with :exact option" do
162
162
  context "when `false`" do
163
163
  it "can match select box approximately" do
164
- @session.select("Finish", :from => "Loc", :exact => false)
164
+ @session.select("Finish", from: "Loc", exact: false)
165
165
  @session.click_button("awesome")
166
166
  expect(extract_results(@session)["locale"]).to eq("fi")
167
167
  end
168
168
 
169
169
  it "can match option approximately" do
170
- @session.select("Fin", :from => "Locale", :exact => false)
170
+ @session.select("Fin", from: "Locale", exact: false)
171
171
  @session.click_button("awesome")
172
172
  expect(extract_results(@session)["locale"]).to eq("fi")
173
173
  end
174
174
 
175
175
  it "can match option approximately when :from not given" do
176
- @session.select("made-up language", :exact => false)
176
+ @session.select("made-up language", exact: false)
177
177
  @session.click_button("awesome")
178
178
  expect(extract_results(@session)["locale"]).to eq("jo")
179
179
  end
@@ -182,19 +182,19 @@ Capybara::SpecHelper.spec "#select" do
182
182
  context "when `true`" do
183
183
  it "can match select box approximately" do
184
184
  expect do
185
- @session.select("Finish", :from => "Loc", :exact => true)
185
+ @session.select("Finish", from: "Loc", exact: true)
186
186
  end.to raise_error(Capybara::ElementNotFound)
187
187
  end
188
188
 
189
189
  it "can match option approximately" do
190
190
  expect do
191
- @session.select("Fin", :from => "Locale", :exact => true)
191
+ @session.select("Fin", from: "Locale", exact: true)
192
192
  end.to raise_error(Capybara::ElementNotFound)
193
193
  end
194
194
 
195
195
  it "can match option approximately when :from not given" do
196
196
  expect do
197
- @session.select("made-up language", :exact => true)
197
+ @session.select("made-up language", exact: true)
198
198
  end.to raise_error(Capybara::ElementNotFound)
199
199
  end
200
200
  end
@@ -27,14 +27,14 @@ Capybara::SpecHelper.spec "#uncheck" do
27
27
 
28
28
  context "with :exact option" do
29
29
  it "should accept partial matches when false" do
30
- @session.uncheck('Ham', :exact => false)
30
+ @session.uncheck('Ham', exact: false)
31
31
  @session.click_button('awesome')
32
32
  expect(extract_results(@session)['pets']).not_to include('hamster')
33
33
  end
34
34
 
35
35
  it "should not accept partial matches when true" do
36
36
  expect do
37
- @session.uncheck('Ham', :exact => true)
37
+ @session.uncheck('Ham', exact: true)
38
38
  end.to raise_error(Capybara::ElementNotFound)
39
39
  end
40
40
  end