Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bin/rspec
7 changes: 2 additions & 5 deletions lib/rspec/graphql_response/helpers/execute_graphql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions lib/rspec/graphql_response/validators/validation_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down