diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 082ddd7..3473a14 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,14 +1,19 @@ name: Test rspec-graphql_response on: push: - branches: [ $default-branch ] + branches: [$default-branch] pull_request: jobs: test: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: ["2.6", "2.7", "3.0"] steps: - - uses: actions/checkout@v2 - - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - run: bin/rspec \ No newline at end of file + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - run: bin/rspec diff --git a/lib/rspec/graphql_response/helpers/execute_graphql.rb b/lib/rspec/graphql_response/helpers/execute_graphql.rb index 7b74f06..4130610 100644 --- a/lib/rspec/graphql_response/helpers/execute_graphql.rb +++ b/lib/rspec/graphql_response/helpers/execute_graphql.rb @@ -6,12 +6,9 @@ operation_vars = graphql_variables if respond_to? :graphql_variables operation_vars = self.instance_eval(&graphql_variables) if operation_vars.is_a? Proc - + operation_context = graphql_context if respond_to? :graphql_context operation_context = self.instance_eval(&operation_context) if operation_context.is_a? Proc - config.graphql_schema.execute(operation, { - variables: operation_vars, - context: operation_context - }) + config.graphql_schema.execute(operation, variables: operation_vars, context: operation_context) end diff --git a/lib/rspec/graphql_response/validators/validation_base.rb b/lib/rspec/graphql_response/validators/validation_base.rb index 1d82254..1717615 100644 --- a/lib/rspec/graphql_response/validators/validation_base.rb +++ b/lib/rspec/graphql_response/validators/validation_base.rb @@ -17,18 +17,18 @@ def validate_negated(&validate_negated_method) end end - def validate(response, *args) + def validate(response, **args) validate_method = self.class.instance_variable_get(:@validate_method) runner = ValidationRunner.new(self) - runner.instance_exec(response, *args, &validate_method) + runner.instance_exec(response, **args, &validate_method) end - def validate_negated(response, *args) + def validate_negated(response, **args) validate_negated_method = self.class.instance_variable_get(:@validate_negated_method) runner = ValidationRunner.new(self) - runner.instance_exec(response, *args, &validate_negated_method) + runner.instance_exec(response, **args, &validate_negated_method) end def failure_message(type)