Skip to content

Commit e6d8449

Browse files
committed
Split the test matrix.
Fix JRuby tests.
1 parent 9e456dc commit e6d8449

File tree

11 files changed

+224
-63
lines changed

11 files changed

+224
-63
lines changed

.github/workflows/head.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Tests (HEAD)
2+
on: [pull_request]
3+
jobs:
4+
test:
5+
runs-on: ubuntu-latest
6+
continue-on-error: true
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
entry:
11+
- { ruby: "3.2", grape-swagger: "HEAD" }
12+
- { ruby: "ruby-head", grape-swagger: "HEAD" }
13+
- { ruby: "jruby-head", grape-swagger: "HEAD" }
14+
env:
15+
GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: ${{ matrix.entry.ruby }}
22+
bundler-cache: true
23+
- name: Setup Firefox
24+
uses: browser-actions/setup-firefox@v1
25+
with:
26+
firefox-version: "111.0.1"
27+
- uses: browser-actions/setup-geckodriver@latest
28+
with:
29+
geckodriver-version: "0.32.2"
30+
- uses: coactions/setup-xvfb@v1
31+
with:
32+
run: bundle exec rake spec

.github/workflows/test.yml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
11
name: Tests
2-
on:
3-
push:
4-
branches:
5-
- master
6-
pull_request:
2+
on: [push, pull_request]
73
jobs:
84
test:
95
runs-on: ubuntu-latest
10-
continue-on-error: ${{ (matrix.grape-swagger.experimental) || (matrix.ruby.experimental) }}
116
strategy:
127
fail-fast: false
138
matrix:
14-
grape-swagger:
15-
- { version: "1.6.0", experimental: false }
16-
- { version: "HEAD", experimental: true }
17-
ruby:
18-
- { version: "2.7", experimental: false }
19-
- { version: "3.0", experimental: false }
20-
- { version: "3.1", experimental: false }
21-
- { version: "3.2", experimental: false }
22-
- { version: "ruby-head", experimental: true }
23-
- { version: "jruby-9.4.2", experimental: false }
24-
- { version: "jruby-head", experimental: true }
9+
entry:
10+
- { ruby: "2.7", grape-swagger: "1.6.1" }
11+
- { ruby: "3.0", grape-swagger: "1.6.1" }
12+
- { ruby: "3.1", grape-swagger: "1.6.1" }
13+
- { ruby: "3.2", grape-swagger: "1.6.1" }
14+
- { ruby: "3.2", grape-swagger: "2.0.2" }
15+
- { ruby: "jruby-9.4.6", grape-swagger: "1.6.1" }
16+
- { ruby: "jruby-9.4.6", grape-swagger: "2.0.2" }
2517
env:
26-
GRAPE_SWAGGER_VERSION: ${{ matrix.grape-swagger.version }}
18+
GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }}
2719
steps:
2820
- uses: actions/checkout@v3
2921
- name: Set up Ruby
3022
uses: ruby/setup-ruby@v1
3123
with:
32-
ruby-version: ${{ matrix.ruby.version }}
24+
ruby-version: ${{ matrix.entry.ruby }}
3325
bundler-cache: true
3426
- name: Setup Firefox
3527
uses: browser-actions/setup-firefox@v1

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
AllCops:
22
TargetRubyVersion: 2.7
3+
NewCops: enable
34

45
inherit_from: .rubocop_todo.yml
6+
7+
require:
8+
- rubocop-capybara
9+
- rubocop-rake
10+
- rubocop-rspec

.rubocop_todo.yml

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2024-02-22 14:55:40 UTC using RuboCop version 1.60.2.
3+
# on 2024-04-06 14:14:58 UTC using RuboCop version 1.62.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 6
10+
# Configuration parameters: EnforcedStyle.
11+
# SupportedStyles: link_or_button, strict
12+
Capybara/ClickLinkOrButtonStyle:
13+
Exclude:
14+
- 'spec/features/swagger_spec.rb'
15+
16+
# Offense count: 1
17+
Capybara/SpecificMatcher:
18+
Exclude:
19+
- 'spec/features/welcome_spec.rb'
20+
921
# Offense count: 1
1022
# Configuration parameters: Severity, Include.
1123
# Include: **/*.gemspec
@@ -25,11 +37,11 @@ Lint/MixedRegexpCaptureTypes:
2537
Exclude:
2638
- 'lib/tasks/swagger_ui.rake'
2739

28-
# Offense count: 9
29-
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
40+
# Offense count: 4
41+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
3042
# AllowedMethods: refine
3143
Metrics/BlockLength:
32-
Max: 291
44+
Max: 89
3345

3446
# Offense count: 2
3547
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
@@ -40,6 +52,63 @@ Naming/FileName:
4052
- 'lib/grape-swagger-rails.rb'
4153
- 'spec/features/grape-swagger-rails_spec.rb'
4254

55+
# Offense count: 13
56+
# Configuration parameters: Prefixes, AllowedPatterns.
57+
# Prefixes: when, with, without
58+
RSpec/ContextWording:
59+
Exclude:
60+
- 'spec/features/swagger_spec.rb'
61+
62+
# Offense count: 1
63+
# This cop supports unsafe autocorrection (--autocorrect-all).
64+
# Configuration parameters: SkipBlocks, EnforcedStyle.
65+
# SupportedStyles: described_class, explicit
66+
RSpec/DescribedClass:
67+
Exclude:
68+
- 'spec/features/grape-swagger-rails_spec.rb'
69+
70+
# Offense count: 6
71+
# Configuration parameters: CountAsOne.
72+
RSpec/ExampleLength:
73+
Max: 8
74+
75+
# Offense count: 1
76+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
77+
# Include: **/*_spec*rb*, **/spec/**/*
78+
RSpec/FilePath:
79+
Exclude:
80+
- 'spec/features/grape-swagger-rails_spec.rb'
81+
82+
# Offense count: 2
83+
# Configuration parameters: AssignmentOnly.
84+
RSpec/InstanceVariable:
85+
Exclude:
86+
- 'spec/features/swagger_spec.rb'
87+
88+
# Offense count: 12
89+
RSpec/MultipleExpectations:
90+
Max: 4
91+
92+
# Offense count: 2
93+
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
94+
# SupportedStyles: always, named_only
95+
RSpec/NamedSubject:
96+
Exclude:
97+
- 'spec/features/grape-swagger-rails_spec.rb'
98+
99+
# Offense count: 12
100+
# Configuration parameters: AllowedGroups.
101+
RSpec/NestedGroups:
102+
Max: 4
103+
104+
# Offense count: 1
105+
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
106+
# Include: **/*_spec.rb
107+
RSpec/SpecFilePathFormat:
108+
Exclude:
109+
- '**/spec/routing/**/*'
110+
- 'spec/features/grape-swagger-rails_spec.rb'
111+
43112
# Offense count: 4
44113
# Configuration parameters: AllowedConstants.
45114
Style/Documentation:
@@ -51,8 +120,13 @@ Style/Documentation:
51120
- 'lib/grape-swagger-rails/engine.rb'
52121

53122
# Offense count: 1
123+
Style/OpenStructUse:
124+
Exclude:
125+
- 'lib/grape-swagger-rails.rb'
126+
127+
# Offense count: 2
54128
# This cop supports safe autocorrection (--autocorrect).
55129
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
56130
# URISchemes: http, https
57131
Layout/LineLength:
58-
Max: 124
132+
Max: 143

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* [#114](https://github.com/ruby-grape/grape-swagger-rails/pull/114): Add `api_key_placeholder` option - [@SofiaSousa](https://github.com/SofiaSousa).
77
* [#116](https://github.com/ruby-grape/grape-swagger-rails/pull/116): Ensure that `ostruct` is loaded - [@jrmhaig](https://github.com/jrmhaig).
88
* [#117](https://github.com/ruby-grape/grape-swagger-rails/pull/117): Fix rubygems source code location metadata - [@dblock](https://github.com/dblock).
9+
* [#118](https://github.com/ruby-grape/grape-swagger-rails/pull/118): Split the test matrix, fix JRuby tests - [@dblock](https://github.com/dblock).
910

1011
### 0.4.0 (2023/03/28)
1112

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ group :development, :test do
2323
gem 'rake'
2424
gem 'rspec-rails'
2525
gem 'rubocop'
26+
gem 'rubocop-capybara'
27+
gem 'rubocop-rake'
28+
gem 'rubocop-rspec'
2629
gem 'ruby-grape-danger', '~> 0.2.0', require: false
2730
gem 'selenium-webdriver'
2831
gem 'sprockets-rails', require: 'sprockets/railtie'

grape-swagger-rails.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Gem::Specification.new do |spec|
1414
spec.homepage = 'https://github.com/ruby-grape/grape-swagger-rails'
1515
spec.license = 'MIT'
1616
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
17-
spec.test_files = `git ls-files spec`.split($INPUT_RECORD_SEPARATOR)
1817
spec.require_paths = %w[lib]
1918
spec.add_dependency 'railties', '>= 6.0.6.1'
2019
spec.metadata = {

spec/dummy/config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
config.active_support.report_deprecations = false
6666

6767
# Use default logging formatter so that PID and timestamp are not suppressed.
68-
config.log_formatter = ::Logger::Formatter.new
68+
config.log_formatter = Logger::Formatter.new
6969

7070
# Use a different logger for distributed setups.
7171
# require "syslog/logger"

spec/features/grape-swagger-rails_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
require 'spec_helper'
44

55
describe GrapeSwaggerRails do
6-
context '#options' do
6+
describe '#options' do
77
subject do
88
GrapeSwaggerRails.options
99
end
10+
1011
it 'is an instance of Options' do
1112
expect(subject).to be_a GrapeSwaggerRails::Options
1213
end
14+
1315
it 'defaults headers to an empty hash' do
1416
expect(subject.headers).to eq({})
1517
end

0 commit comments

Comments
 (0)