Skip to content

Commit c4277c6

Browse files
authored
ruby 3.0 supporting (#26)
1 parent 916ad8c commit c4277c6

File tree

12 files changed

+39
-34
lines changed

12 files changed

+39
-34
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
language: ruby
44
cache: bundler
55
before_install:
6-
- gem install bundler -v 2.1.4
6+
- gem install bundler -v 2.2.32
77
stages:
88
- test
99
- deploy
1010
jobs:
1111
include:
12+
- name: "Test Ruby-3.0.3 Rails-6.1"
13+
stage: test
14+
rvm: 3.0.3
15+
env: RAILS_VERSION="~> 6.1"
16+
before_script: bundle install
17+
script: bundle exec rake default
1218
- name: "Test Ruby-2.5.7 Rails-6.0"
1319
stage: test
1420
rvm: 2.5.7

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ gem 'puma'
1313
gem 'rake', '~> 12.0'
1414
gem 'rspec-rails', '~> 4.0'
1515
gem 'rubocop', '~> 0.81.0', require: false
16-
gem 'system_test_html_screenshots', require: false
1716
gem 'yard', require: false
1817

1918
gem 'activeadmin', ENV.fetch('ACTIVE_ADMIN_VERSION', '~> 2.0'), require: false
@@ -28,4 +27,4 @@ end
2827

2928
gem 'sassc-rails', '2.1.2'
3029
gem 'sprockets', '3.7.2'
31-
gem 'sqlite3', '1.4.1'
30+
gem 'sqlite3'

lib/capybara/active_admin/actions/form.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Actions
66
module Form
77
def click_submit(value, options = {})
88
selector = form_submit_selector(value)
9-
find(selector, options).click
9+
find(selector, **options).click
1010
end
1111

1212
def fill_in_file(label, options = {})

lib/capybara/active_admin/actions/layout.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ module Actions
77
module Layout
88
def click_action_item(title, options = {})
99
within(action_items_container_selector) do
10-
click_link(title, options)
10+
click_link(title, **options)
1111
end
1212
end
1313

1414
def switch_tab(tab_name, options = {})
1515
opts = Util.options_with_text(tab_name, options)
16-
find(tab_header_link_selector, opts).click
16+
find(tab_header_link_selector, **opts).click
1717
end
1818

1919
def click_batch_action(title, exact: true)
2020
open_batch_action_menu
2121
within(dropdown_list_selector) do
2222
selector = batch_action_selector
2323
opts = Util.options_with_text(title, exact: exact)
24-
find(selector, opts).click
24+
find(selector, **opts).click
2525
end
2626
end
2727

lib/capybara/active_admin/finders/layout.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Finders
77
module Layout
88
def find_footer(options = {})
99
selector = footer_selector
10-
have_selector(selector, options)
10+
have_selector(selector, **options)
1111
end
1212

1313
def within_tab_body
@@ -26,7 +26,7 @@ def within_sidebar(title, exact: nil)
2626
def within_panel(title, exact: nil)
2727
title_selector = "#{panel_selector} > #{panel_title_selector}"
2828
title_opts = Util.options_with_text(title, exact: exact)
29-
panel_title = find(title_selector, title_opts)
29+
panel_title = find(title_selector, **title_opts)
3030
panel_content = panel_title.sibling(panel_content_selector)
3131

3232
within(panel_content) { yield }

lib/capybara/active_admin/matchers/attributes_table.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ def have_attributes_table(options = {})
88
model = options.delete(:model)
99
id = options.delete(:id)
1010
selector = attributes_table_selector(model: model, id: id)
11-
have_selector(selector, options)
11+
have_selector(selector, **options)
1212
end
1313

1414
def have_attribute_row(label, options = {})
1515
selector = attributes_row_selector(label)
16-
have_selector(selector, options)
16+
have_selector(selector, **options)
1717
end
1818
end
1919
end

lib/capybara/active_admin/matchers/form.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@ module Form
77
def have_form_error(text, options = {})
88
field = options.delete(:field)
99
opts = Util.options_with_text(text, options)
10-
li_selector = input_container_selector field, options.slice(:exact)
10+
li_selector = input_container_selector field, **options.slice(:exact)
1111

12-
have_selector("#{li_selector} #{inline_error_selector}", opts)
12+
have_selector("#{li_selector} #{inline_error_selector}", **opts)
1313
end
1414

1515
def have_no_form_errors(options = {})
1616
field = options.delete(:field)
17-
li_selector = input_container_selector field, options.slice(:exact)
17+
li_selector = input_container_selector field, **options.slice(:exact)
1818

19-
have_none_of_selectors(:css, "#{li_selector} #{inline_error_selector}", options)
19+
have_none_of_selectors(:css, "#{li_selector} #{inline_error_selector}", **options)
2020
end
2121

2222
def have_semantic_error(text, options = {})
2323
opts = Util.options_with_text(text, options)
24-
have_selector(semantic_error_selector, opts)
24+
have_selector(semantic_error_selector, **opts)
2525
end
2626

2727
def have_semantic_errors(options = {})
28-
have_selector(semantic_error_selector, options)
28+
have_selector(semantic_error_selector, **options)
2929
end
3030

3131
def have_has_many_fields_for(association_name, options = {})
3232
selector = has_many_fields_selector(association_name)
33-
have_selector(selector, options)
33+
have_selector(selector, **options)
3434
end
3535

3636
# @param text [String] button title
@@ -46,7 +46,7 @@ def have_has_many_fields_for(association_name, options = {})
4646
def have_submit_input(text, options = {})
4747
selector = "#{form_submit_selector(text)}#{options.delete(:selector)}"
4848
selector += '[disabled="disabled"].disabled' if options.delete(:disabled)
49-
have_selector(selector, options)
49+
have_selector(selector, **options)
5050
end
5151
end
5252
end

lib/capybara/active_admin/matchers/layout.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,42 @@ module Matchers
77
module Layout
88
def have_action_item(text, options = {})
99
opts = Util.options_with_text(text, options)
10-
have_selector(action_item_selector, opts)
10+
have_selector(action_item_selector, **opts)
1111
end
1212

1313
def have_page_title(text, options = {})
1414
opts = Util.options_with_text(text, options)
15-
have_selector(page_title_selector, opts)
15+
have_selector(page_title_selector, **opts)
1616
end
1717

1818
def have_flash_message(text, options = {})
1919
type = options.delete(:type)
2020
opts = Util.options_with_text(text, options)
2121
selector = flash_message_selector(type)
22-
have_selector(selector, opts)
22+
have_selector(selector, **opts)
2323
end
2424

2525
def have_footer(options = {})
2626
selector = footer_selector
27-
have_selector(selector, options)
27+
have_selector(selector, **options)
2828
end
2929

3030
def have_panel(title, options = {})
3131
title_selector = "#{panel_selector} > #{panel_title_selector}"
3232
opts = Util.options_with_text(title, options)
33-
have_selector(title_selector, opts)
33+
have_selector(title_selector, **opts)
3434
end
3535

3636
def have_sidebar(title, options = {})
3737
title_selector = "#{sidebar_selector} #{panel_selector} > #{panel_title_selector}"
3838
opts = Util.options_with_text(title, options)
39-
have_selector(title_selector, opts)
39+
have_selector(title_selector, **opts)
4040
end
4141

4242
def have_batch_action(title, exact: true)
4343
selector = "#{dropdown_list_selector} #{batch_action_selector}"
4444
opts = Util.options_with_text(title, exact: exact)
45-
have_selector(selector, opts)
45+
have_selector(selector, **opts)
4646
end
4747
end
4848
end

lib/capybara/active_admin/matchers/table.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module Table
1414
def have_table(options = {})
1515
resource_name = options.delete(:resource_name)
1616
selector = table_selector(resource_name)
17-
have_selector(selector, options)
17+
have_selector(selector, **options)
1818
end
1919

2020
# @param options [Hash]
@@ -30,7 +30,7 @@ def have_table(options = {})
3030
def have_table_row(options = {})
3131
row_id = options.delete(:id)
3232
selector = table_row_selector(row_id)
33-
have_selector(selector, options)
33+
have_selector(selector, **options)
3434
end
3535

3636
# @param options [Hash]
@@ -51,13 +51,13 @@ def have_table_cell(options = {})
5151
column = options.delete(:column)
5252
selector = table_cell_selector(column)
5353

54-
have_selector(selector, options)
54+
have_selector(selector, **options)
5555
end
5656

5757
# @param options [Hash]
5858
# @option count [Integer] qty of nodes
5959
def have_table_scopes(options = {})
60-
have_selector("#{table_scopes_container_selector} > #{table_scope_selector}", options)
60+
have_selector("#{table_scopes_container_selector} > #{table_scope_selector}", **options)
6161
end
6262

6363
# @param options [Hash]
@@ -69,7 +69,7 @@ def have_table_scope(options = {})
6969
selector = "#{table_scopes_container_selector} > #{table_scope_selector}"
7070
selector = active ? "#{selector}.selected" : "#{selector}:not(.selected)"
7171

72-
have_selector(selector, options)
72+
have_selector(selector, **options)
7373
end
7474
end
7575
end

lib/capybara/active_admin/selectors/form.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def input_container_selector(label = nil, exact: nil)
5656
return 'li' if label.nil?
5757

5858
label_opts = Util.options_with_text(label, exact: exact)
59-
label_node = find(label_selector, label_opts)
59+
label_node = find(label_selector, **label_opts)
6060
li_id = label_node.ancestor('li')[:id]
6161
"li##{li_id}"
6262
end

0 commit comments

Comments
 (0)