Skip to content

Commit 1b0ea2b

Browse files
author
Mattia Roccoberton
authored
Merge pull request #21 from blocknotes/support-for-ruby-3.0
Update GitHub actions for Ruby 3.0
2 parents dbc580e + 9005304 commit 1b0ea2b

File tree

3 files changed

+50
-10
lines changed

3 files changed

+50
-10
lines changed

.github/workflows/specs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Specs
2+
name: Specs Rails 6.0
33

44
on:
55
pull_request:
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
ruby: ['2.6', '2.7']
17-
gemfile: ['rails60_activeadmin22', 'rails60_activeadmin', 'rails61_activeadmin29', 'rails61_activeadmin']
17+
gemfile: ['rails60_activeadmin22', 'rails60_activeadmin']
1818

1919
env:
2020
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile

.github/workflows/specs2.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Specs Rails 6.1
3+
4+
on:
5+
pull_request:
6+
branches: [master]
7+
push:
8+
branches: [master]
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
ruby: ['2.6', '2.7', '3.0']
17+
gemfile: ['rails61_activeadmin29', 'rails61_activeadmin']
18+
19+
env:
20+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v2
25+
26+
- name: Set up Ruby
27+
uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: ${{ matrix.ruby }}
30+
bundler-cache: true
31+
32+
- name: Run tests
33+
run: bundle exec rspec --profile
34+
35+
- name: On failure, archive screenshots as artifacts
36+
uses: actions/upload-artifact@v2
37+
if: failure()
38+
with:
39+
name: test-failed-screenshots
40+
path: spec/dummy/tmp/screenshots

spec/system/dynamic_fields_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ def test_unset_css(target, options = {})
5353
expect(page).to have_css(target)
5454
end
5555

56-
def test_change_css(target, attrs1, attrs2, options = {})
56+
def test_change_css(target, options = {})
5757
spec_message("test change CSS on #{target} ...")
5858

59-
expect(page).to have_css(target, attrs1)
59+
expect(page).to have_css(target, **options[:attrs1])
6060
block_given? ? yield : apply_action(options[:action])
61-
expect(page).to have_css(target, attrs2)
61+
expect(page).to have_css(target, **options[:attrs2])
6262
return if options[:one_way]
6363

6464
block_given? ? yield : apply_action(options[:action], inverse: true)
65-
expect(page).to have_css(target, attrs1)
65+
expect(page).to have_css(target, **options[:attrs1])
6666
end
6767

6868
context 'with some dynamic fields' do
@@ -132,17 +132,17 @@ def test_change_css(target, attrs1, attrs2, options = {})
132132
# --- hide
133133
spec_message('check data-then="hide" action')
134134
target = '#post_data_field_241_input .inline-hints'
135-
test_change_css(target, { visible: :visible }, { visible: :hidden }, action: [:click, '#post_data_field_241'])
135+
test_change_css(target, { attrs1: { visible: :visible }, attrs2: { visible: :hidden }, action: [:click, '#post_data_field_241'] })
136136

137137
# --- fade
138138
spec_message('check data-then="fade" action')
139139
target = '#post_data_field_251_input .inline-hints'
140-
test_change_css(target, { visible: :visible }, { visible: :hidden }, action: [:click, '#post_data_field_251'])
140+
test_change_css(target, { attrs1: { visible: :visible }, attrs2: { visible: :hidden }, action: [:click, '#post_data_field_251'] })
141141

142142
# --- slide
143143
spec_message('check data-then="slide" action')
144144
target = '#post_data_field_261_input .inline-hints'
145-
test_change_css(target, { visible: :visible }, { visible: :hidden }, action: [:click, '#post_data_field_261'])
145+
test_change_css(target, { attrs1: { visible: :visible }, attrs2: { visible: :hidden }, action: [:click, '#post_data_field_261'] })
146146

147147
# --- setText
148148
spec_message('check data-then="setText ..." action')
@@ -154,7 +154,7 @@ def test_change_css(target, attrs1, attrs2, options = {})
154154
spec_message('check data-then="addStyle ..." action')
155155
style1 = { style: { 'margin-right': '20px' } }
156156
style2 = { style: 'margin-right: 20px; font-size: 10px; padding: 3px' }
157-
test_change_css('#post_data_field_281', style1, style2, action: [:click, '#post_data_field_281'])
157+
test_change_css('#post_data_field_281', { attrs1: style1, attrs2: style2, action: [:click, '#post_data_field_281'] })
158158

159159
# --- gtarget
160160
spec_message('check data-gtarget="..."')

0 commit comments

Comments
 (0)