Skip to content

Commit 72d28a6

Browse files
authored
Fix CI with kwargs change (#47)
* Push kwargs onto middleware stack * Remove CODACY env * Use bundler cache * Revert "Remove CODACY env" This reverts commit 635470e. * Remove Codacy from CI
1 parent f1d4fa1 commit 72d28a6

3 files changed

Lines changed: 10 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ jobs:
2525
- "3.3"
2626
- "3.2"
2727
- "3.1"
28-
env:
29-
CODACY_RUN_LOCAL: true
30-
CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}}
3128
steps:
3229
- uses: actions/checkout@v1
3330
- name: Install package dependencies
@@ -36,6 +33,7 @@ jobs:
3633
uses: ruby/setup-ruby@v1
3734
with:
3835
ruby-version: ${{matrix.ruby}}
36+
bundler-cache: true # 'bundle install' and cache gems
3937
- name: Install latest bundler
4038
run: |
4139
gem install bundler --no-document

lib/hanami/api/middleware.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ def initialize(prefix)
2323

2424
# @since 0.1.0
2525
# @api private
26-
def use(path, middleware, *args, &blk)
26+
def use(path, middleware, *args, **kwargs, &blk)
2727
# FIXME: test with prefix when Hanami::API.settings and prefix will be supported
2828
@stack[path] ||= []
29-
@stack[path].push([middleware, args, blk])
29+
@stack[path].push([middleware, args, kwargs, blk])
3030
end
3131

3232
# @since 0.1.1

spec/unit/hanami/api/middleware/stack_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515

1616
actual = subject.to_hash
1717
expected = {
18-
"/" => [["elapsed time", [], nil]],
19-
"/admin" => [["elapsed time", [], nil], ["admin auth", [], nil]],
20-
"/api" => [["elapsed time", [], nil], ["rate limiter", [4000], nil]],
21-
"/api/v1" => [["elapsed time", [], nil], ["rate limiter", [4000], nil], ["api v1 auth", ["secret-token"], nil], ["api v1 deprecation", [Date.today], nil]],
22-
"/api/v2" => [["elapsed time", [], nil], ["rate limiter", [4000], nil], ["api v2 auth", [], nil]],
23-
"/:locale" => [["elapsed time", [], nil], ["set locale", [], nil]],
24-
"/:locale/it" => [["elapsed time", [], nil], ["set locale", [], nil], ["analytics", [:it], nil]]
18+
"/" => [["elapsed time", [], {}, nil]],
19+
"/admin" => [["elapsed time", [], {}, nil], ["admin auth", [], {}, nil]],
20+
"/api" => [["elapsed time", [], {}, nil], ["rate limiter", [4000], {}, nil]],
21+
"/api/v1" => [["elapsed time", [], {}, nil], ["rate limiter", [4000], {}, nil], ["api v1 auth", ["secret-token"], {}, nil], ["api v1 deprecation", [Date.today], {}, nil]],
22+
"/api/v2" => [["elapsed time", [], {}, nil], ["rate limiter", [4000], {}, nil], ["api v2 auth", [], {}, nil]],
23+
"/:locale" => [["elapsed time", [], {}, nil], ["set locale", [], {}, nil]],
24+
"/:locale/it" => [["elapsed time", [], {}, nil], ["set locale", [], {}, nil], ["analytics", [:it], {}, nil]]
2525
}
2626

2727
expect(actual).to eq(expected)

0 commit comments

Comments
 (0)