Skip to content

Let the RSpec controller helpers test context be read with dig - #317

Merged
povilasjurcys merged 1 commit into
masterfrom
feature/BAC-530-fake-context-dig
Oct 19, 2026
Merged

povilasjurcys merged 1 commit into
masterfrom
feature/BAC-530-fake-context-dig

Conversation

@povilasjurcys

Copy link
Copy Markdown
Collaborator

What's the reason for this feature?

Currently, the RSpec controller helpers' FakeContext delegates only [], []=, to_h, key? and fetch. Since #316 exposes it as response.context, rspec_extra_matchers' be_successful_graphql_request passes it to model fields. Fields that call graphql_context&.dig(...) then raise NoMethodError, though GraphQL::Query::Context supports dig at runtime.

This PR delegates dig from FakeContext to the provided values and documents which methods the test context supports.

Reviewers should know:

🤖 Generated with Claude Code

FakeContext now delegates dig, as GraphQL::Query::Context does, so
models that call graphql_context&.dig(...) work with the context that
response.context exposes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.17%. Comparing base (4300ee4) to head (02e4ee4).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #317   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files          68       68           
  Lines        1922     1922           
=======================================
  Hits         1887     1887           
  Misses         35       35           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@povilasjurcys
povilasjurcys merged commit 713ccdc into master Oct 19, 2026
13 checks passed
@povilasjurcys
povilasjurcys deleted the feature/BAC-530-fake-context-dig branch October 19, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant