Skip to content

Commit 0833d14

Browse files
committed
Add Rails 7 to the test matrix.
1 parent a91b179 commit 0833d14

File tree

9 files changed

+41
-58
lines changed

9 files changed

+41
-58
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
name: Tests
1+
---
2+
name: ruby-tests
23

34
on:
4-
pull_request:
5-
branches:
6-
- main
5+
pull_request_target:
76
push:
87
branches:
98
- main
10-
11-
schedule:
12-
- cron: "0 10 * * *"
9+
workflow_dispatch:
10+
inputs: {}
1311

1412
jobs:
1513
build:
1614
name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
1715
runs-on: "ubuntu-latest"
16+
if: |
17+
github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target' ||
18+
github.actor != 'dependabot[bot]'
1819
strategy:
1920
fail-fast: false
2021
matrix:
21-
ruby: ["3.0.x", "2.7.x", "2.6.x", "2.5.x"]
22+
ruby: ["2.7", "3.0", "3.1"]
2223
gemfile:
2324
- Gemfile
24-
- gemfiles/rails6_1.gemfile
25-
- gemfiles/rails6_0.gemfile
25+
- gemfiles/7_0.gemfile
26+
- gemfiles/6_1.gemfile
27+
- gemfiles/6_0.gemfile
2628

2729
steps:
28-
- uses: actions/checkout@v1
30+
- uses: actions/checkout@v2.4.0
2931

3032
- uses: actions/cache@v2
3133
with:
3234
path: vendor/bundle
3335
key: >
34-
${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
35-
restore-keys: >
36-
${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
36+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{
37+
hashFiles(matrix.gemfile) }}
3738
3839
- name: Set up Ruby
39-
uses: actions/setup-ruby@v1
40+
uses: ruby/setup-ruby@v1
4041
with:
4142
ruby-version: ${{ matrix.ruby }}
4243

4344
- name: Install gem dependencies
4445
env:
45-
RAILS_ENV: test
4646
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
4747
run: |
4848
gem install bundler
@@ -51,7 +51,8 @@ jobs:
5151
5252
- name: Run Tests
5353
env:
54-
RAILS_ENV: test
54+
PGHOST: localhost
55+
PGUSER: postgres
5556
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
5657
run: |
5758
bundle exec rake

.rubocop.yml

+1-24
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ inherit_gem:
44

55
AllCops:
66
TargetRubyVersion: 2.5
7+
NewCops: enable
78
Exclude:
89
- bin/**/*
910
- gemfiles/**/*
@@ -13,29 +14,5 @@ AllCops:
1314
- "*.gemspec"
1415
- config.ru
1516

16-
Metrics/ClassLength:
17-
Enabled: false
18-
19-
Layout/LineLength:
20-
Max: 80
21-
22-
Metrics/MethodLength:
23-
Enabled: false
24-
25-
Style/Alias:
26-
EnforcedStyle: prefer_alias_method
27-
28-
Lint/RedundantCopDisableDirective:
29-
Enabled: false
30-
31-
Metrics/AbcSize:
32-
Enabled: false
33-
34-
Metrics/CyclomaticComplexity:
35-
Enabled: false
36-
37-
Metrics/PerceivedComplexity:
38-
Enabled: false
39-
4017
Naming/VariableNumber:
4118
Enabled: false

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Browser
22

3-
[![Tests](https://github.com/fnando/browser/workflows/Tests/badge.svg)](https://github.com/fnando/browser)
4-
[![Code Climate](https://codeclimate.com/github/fnando/browser/badges/gpa.svg)](https://codeclimate.com/github/fnando/browser)
3+
[![Tests](https://github.com/fnando/browser/workflows/ruby-tests/badge.svg)](https://github.com/fnando/browser)
54
[![Gem](https://img.shields.io/gem/v/browser.svg)](https://rubygems.org/gems/browser)
65
[![Gem](https://img.shields.io/gem/dt/browser.svg)](https://rubygems.org/gems/browser)
76

gemfiles/rails6_0.gemfile renamed to gemfiles/6_0.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
source "https://rubygems.org"
44
gemspec path: ".."
55

6-
gem "rails", "~> 6.0"
6+
gem "rails", "~> 6.0.0"

gemfiles/rails6_1.gemfile renamed to gemfiles/6_1.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
source "https://rubygems.org"
44
gemspec path: ".."
55

6-
gem "rails", "~> 6.1"
6+
gem "rails", "~> 6.1.0"

gemfiles/7_0.gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
gemspec path: ".."
5+
6+
gem "rails", "~> 7.0.0"

lib/browser/base.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def accept_language
2626
end
2727
end
2828

29-
alias_method :to_a, :meta
29+
alias to_a meta
3030

3131
# Return meta representation as string.
3232
def to_s
@@ -161,7 +161,7 @@ def sputnik?(expected_version = nil)
161161
def yandex?(expected_version = nil)
162162
Yandex.new(ua).match? && detect_version?(full_version, expected_version)
163163
end
164-
alias_method :yandex_browser?, :yandex?
164+
alias yandex_browser? yandex?
165165

166166
# Detect if browser is UCBrowser.
167167
def uc_browser?(expected_version = nil)
@@ -180,7 +180,7 @@ def micro_messenger?(expected_version = nil)
180180
detect_version?(full_version, expected_version)
181181
end
182182

183-
alias_method :wechat?, :micro_messenger?
183+
alias wechat? micro_messenger?
184184

185185
def weibo?(expected_version = nil)
186186
Weibo.new(ua).match? && detect_version?(full_version, expected_version)

lib/browser/device.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def unknown?
9696
def ipod_touch?
9797
id == :ipod_touch
9898
end
99-
alias_method :ipod?, :ipod_touch?
99+
alias ipod? ipod_touch?
100100

101101
def iphone?
102102
id == :iphone
@@ -105,12 +105,12 @@ def iphone?
105105
def ps3?
106106
id == :ps3
107107
end
108-
alias_method :playstation3?, :ps3?
108+
alias playstation3? ps3?
109109

110110
def ps4?
111111
id == :ps4
112112
end
113-
alias_method :playstation4?, :ps4?
113+
alias playstation4? ps4?
114114

115115
def psp?
116116
id == :psp
@@ -119,8 +119,8 @@ def psp?
119119
def playstation_vita?
120120
id == :psvita
121121
end
122-
alias_method :vita?, :playstation_vita?
123-
alias_method :psp_vita?, :playstation_vita?
122+
alias vita? playstation_vita?
123+
alias psp_vita? playstation_vita?
124124

125125
def kindle?
126126
id == :kindle || kindle_fire?
@@ -133,22 +133,22 @@ def kindle_fire?
133133
def nintendo_wii?
134134
id == :wii
135135
end
136-
alias_method :wii?, :nintendo_wii?
136+
alias wii? nintendo_wii?
137137

138138
def nintendo_wiiu?
139139
id == :wiiu
140140
end
141-
alias_method :wiiu?, :nintendo_wiiu?
141+
alias wiiu? nintendo_wiiu?
142142

143143
def nintendo_switch?
144144
id == :switch
145145
end
146-
alias_method :switch?, :nintendo_switch?
146+
alias switch? nintendo_switch?
147147

148148
def blackberry_playbook?
149149
id == :playbook
150150
end
151-
alias_method :playbook?, :blackberry_playbook?
151+
alias playbook? blackberry_playbook?
152152

153153
def surface?
154154
id == :surface

lib/browser/platform.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def ios_webview?
138138
def android_app?
139139
android? && ua.match?(/\bwv\b/)
140140
end
141-
alias_method :android_webview?, :android_app?
141+
alias android_webview? android_app?
142142

143143
# http://msdn.microsoft.com/fr-FR/library/ms537503.aspx#PltToken
144144
def windows_xp?

0 commit comments

Comments
 (0)