Skip to content

Commit 0d23531

Browse files
authored
Merge pull request #2 from Vasfed/github_actions
Replace travis with github actions
2 parents 6ef5af3 + ee9f2f5 commit 0d23531

File tree

14 files changed

+113
-72
lines changed

14 files changed

+113
-72
lines changed

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test
2+
on: [push]
3+
jobs:
4+
runTests:
5+
runs-on: ubuntu-latest
6+
7+
strategy:
8+
matrix:
9+
include:
10+
- ruby-version: 2.3.8
11+
rails-version: 3
12+
- ruby-version: 2.3.8
13+
rails-version: 40
14+
- ruby-version: 2.3.8
15+
rails-version: 42
16+
17+
- ruby-version: 2.3.8
18+
rails-version: 50_rspec
19+
- ruby-version: 2.6.9
20+
rails-version: 50_simplecov
21+
- ruby-version: 2.7.5
22+
rails-version: 6
23+
# - ruby-version: 2.7.5
24+
# rails-version: 70
25+
26+
env:
27+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.rails-version }}.gemfile
28+
29+
steps:
30+
- uses: actions/checkout@master
31+
- name: Install ruby
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
ruby-version: ${{ matrix.ruby-version }}
35+
bundler-cache: true
36+
bundler: '1.17.3'
37+
38+
- name: Run tests
39+
run: |
40+
bundle exec rake spec

.travis.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

Appraisals

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# to test against all, run: appraisal rake spec
44

55
if RUBY_VERSION <= '2.4'
6+
# to get a working ruby 2.3: `docker run --rm -it --volume $PWD:/app ruby:2.3-stretch bash`
67
appraise 'rails-3' do
78
gem 'rails', '~>3.2.22'
89
gem 'test-unit'

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ source 'https://rubygems.org'
66
# NB: all other non-listed gems should go into Appraisals,
77
# this file is only for quick tests
88

9-
unless defined?(Appraisal)
9+
unless defined?(Appraisal) || RUBY_VERSION < '2.6'
1010
# rails should be included before us
1111
gem 'rails', '~>5.2.6'
1212
gem 'simplecov', require: false

gemfiles/rails_3.gemfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
source "https://rubygems.org"
44

55
gem "rails", "~>3.2.22"
6-
gem "simplecov", require: false
7-
gem "sprockets"
8-
gem "sass"
96
gem "test-unit"
107

118
gemspec path: "../"

gemfiles/rails_40.gemfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
source "https://rubygems.org"
44

55
gem "rails", "~>4.0.0"
6-
gem "simplecov", require: false
7-
gem "sprockets"
8-
gem "sass"
96

107
gemspec path: "../"

gemfiles/rails_42.gemfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
source "https://rubygems.org"
44

55
gem "rails", "~>4.2.0"
6-
gem "simplecov", require: false
7-
gem "sprockets"
8-
gem "sass"
96

107
gemspec path: "../"

lib/routes_coverage.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ def self._collect_route_groups(all_routes)
170170
when :constraints
171171
value.all? do |constraint_name, constraint_value|
172172
if constraint_value.present?
173-
route.constraints[constraint_name] && route.constraints[constraint_name].match?(constraint_value)
173+
route.constraints[constraint_name] && route.constraints[constraint_name].match(constraint_value)
174174
else
175175
route.constraints[constraint_name].blank?
176176
end
177177
end
178178
end
179179
end
180180
else
181-
route.path.spec.to_s.match?(matcher)
181+
route.path.spec.to_s.match(matcher)
182182
end
183183
end
184184

@@ -197,9 +197,9 @@ def self._touch_request(req)
197197
else # rails < 4.2
198198
dispatcher = route.app
199199
req.env['action_dispatch.request.path_parameters'] =
200-
(env['action_dispatch.request.path_parameters'] || {}).merge(parameters)
200+
(req.env['action_dispatch.request.path_parameters'] || {}).merge(parameters)
201201
while dispatcher.is_a?(ActionDispatch::Routing::Mapper::Constraints)
202-
dispatcher = (dispatcher.app if dispatcher.matches?(env))
202+
dispatcher = (dispatcher.app if dispatcher.matches?(req.env))
203203
end
204204
end
205205
next unless dispatcher

lib/routes_coverage/result.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ def expected_routes
9595
namespaces_regex = Regexp.union(@settings.exclude_namespaces.map { |n| %r{^/#{n}} })
9696

9797
routes_groups = all_routes.group_by do |r|
98+
# rails <=4 has regex in verb
99+
verb = r.verb.is_a?(Regexp) && r.verb.inspect.gsub(/[^\w]/, '') || r.verb
98100
(
99-
("#{r.verb.to_s[8..-3]} #{r.path.spec}".strip =~ filter_regex) ||
101+
("#{verb} #{r.path.spec}".strip =~ filter_regex) ||
100102
(r.path.spec.to_s =~ namespaces_regex)
101103
).present?
102104
end

routes_coverage.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
2626
spec.require_paths = ["lib"]
2727

2828
spec.add_development_dependency 'appraisal'
29-
spec.add_development_dependency "bundler", ">= 2.2.10"
29+
spec.add_development_dependency "bundler" #, ">= 2.2.10"
3030
spec.add_development_dependency "minitest"
3131
spec.add_development_dependency "rake", ">= 12.3.3"
3232
end

0 commit comments

Comments
 (0)