diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 251e7ac7bb..273537e6fb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,22 +24,27 @@ jobs: fail-fast: false matrix: ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] - gemfile: [rack_2_0, rack_3_0, rails_6_0, rails_6_1, rails_7_0, rails_7_1] - integration: [false] + gemfile: [Gemfile, gemfiles/rack_2_0.gemfile, gemfiles/rack_3_0.gemfile, gemfiles/rails_6_0.gemfile, gemfiles/rails_6_1.gemfile, gemfiles/rails_7_0.gemfile, gemfiles/rails_7_1.gemfile] + specs: ['spec --exclude-pattern=spec/integration/**/*_spec.rb'] include: - ruby: '2.7' - integration: multi_json + gemfile: gemfiles/multi_json.gemfile + specs: 'spec/integration/multi_json' - ruby: '2.7' - integration: multi_xml + gemfile: gemfiles/multi_xml.gemfile + specs: 'spec/integration/multi_xml' - ruby: '2.7' - integration: rack_2_0 + gemfile: gemfiles/rack_2_0.gemfile + specs: 'spec/integration/rack_2_0' - ruby: '2.7' - integration: rack_3_0 + gemfile: gemfiles/rack_3_0.gemfile + specs: 'spec/integration/rack_3_0' - ruby: '3.3' - integration: no_dry_validation + gemfile: gemfiles/no_dry_validation.gemfile + specs: 'spec/integration/no_dry_validation' runs-on: ubuntu-latest env: - BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.integration || matrix.gemfile }}.gemfile + BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }} steps: - uses: actions/checkout@v4 @@ -49,13 +54,8 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Run tests - if: ${{ !matrix.integration }} - run: bundle exec rake spec - - - name: Run integration tests (spec/integration/${{ matrix.integration }}) - if: ${{ matrix.integration }} - run: bundle exec rspec spec/integration/${{ matrix.integration }} + - name: Run Tests (${{ matrix.specs }}) + run: bundle exec rspec ${{ matrix.specs }} - name: Coveralls uses: coverallsapp/github-action@master diff --git a/spec/grape/declared_helpers_spec.rb b/spec/grape/declared_helpers_spec.rb new file mode 100644 index 0000000000..85e2aee230 --- /dev/null +++ b/spec/grape/declared_helpers_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +describe Grape::API do + subject do + Class.new(Grape::API) do + helpers do + def declared(options = {}) + puts "HERE" + _declared(params, { include_missing: false }.merge(options)) + end + end + params do + requires :x, type: Integer + optional :y, type: Integer + end + get do + declared(params) + end + end + end + + def app + subject + end + + it 'works' do + get '/', x: 1 + puts last_response.status + puts last_response.body + end +end