Skip to content

Commit 15cc23b

Browse files
authored
Rails 8 + Fixes and Features (#42)
* Add Rails 8.0 support, drop tests for Rails 6, fix problem with default arguments and validation, and add better way to define type methods on sources * Fix broken specs * Add sqlite3 gem to Rails 8 * Skip test where stub does not work anymore
1 parent 934dc2e commit 15cc23b

File tree

23 files changed

+130
-29
lines changed

23 files changed

+130
-29
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,20 @@ jobs:
4242
fail-fast: false
4343
matrix:
4444
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
45-
rails: ['6.0', '6.1', '7.0', '7.1', '7.2']
45+
rails: ['7.0', '7.1', '7.2', '8.0']
4646
exclude:
47+
# Rails 7.2 requires Ruby 3.1 or higher
4748
- ruby: '2.7'
4849
rails: '7.2'
4950
- ruby: '3.0'
5051
rails: '7.2'
52+
# Rails 8.0 requires Ruby 3.2 or higher
53+
- ruby: '2.7'
54+
rails: '8.0'
55+
- ruby: '3.0'
56+
rails: '8.0'
57+
- ruby: '3.1'
58+
rails: '8.0'
5159

5260
steps:
5361
- uses: actions/checkout@v3

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gemfiles/Gemfile.rails-6.1

Lines changed: 0 additions & 12 deletions
This file was deleted.

gemfiles/Gemfile.rails-7.0

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
33

44
gemspec path: "../"
55

6-
gem 'rails', '~> 7.0'
6+
gem 'rails', '~> 7.0.0'
77
gem 'bootsnap' # required by the Rails apps generated in tests
88
gem 'ruby-prof', platform: :ruby
99
gem 'pry-byebug'

gemfiles/Gemfile.rails-7.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
33

44
gemspec path: "../"
55

6-
gem 'rails', '~> 7.1'
6+
gem 'rails', '~> 7.1.0'
77
gem 'bootsnap' # required by the Rails apps generated in tests
88
gem 'ruby-prof', platform: :ruby
99
gem 'pry-byebug'

gemfiles/Gemfile.rails-7.2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
33

44
gemspec path: "../"
55

6-
gem 'rails', '~> 7.2'
6+
gem 'rails', '~> 7.2.0'
77
gem 'bootsnap' # required by the Rails apps generated in tests
88
gem 'ruby-prof', platform: :ruby
99
gem 'pry-byebug'
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ source 'https://rubygems.org'
33

44
gemspec path: "../"
55

6-
gem 'rails', '~> 6.0'
6+
gem 'rails', '~> 8.0.0'
77
gem 'bootsnap' # required by the Rails apps generated in tests
88
gem 'ruby-prof', platform: :ruby
99
gem 'pry-byebug'
10+
gem 'sqlite3'
1011

1112
gem 'flamegraph'
1213
gem 'stackprof'

lib/rails/graphql.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require 'i18n'
44
require 'zlib'
5+
require 'ostruct'
56
require 'active_model'
67
require 'active_support'
78

lib/rails/graphql/field/output_field.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def has_argument?(name)
4141
super || field.has_argument?(name)
4242
end
4343

44+
def has_arguments?
45+
super || field.has_arguments?
46+
end
47+
4448
def arguments?
4549
super || field.arguments?
4650
end

lib/rails/graphql/helpers/attribute_delegator.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@ module GraphQL
55
module Helpers
66
# This is an extra magic on top of the delegator class from the standard
77
# lib that allows fetching a specific property of the delegated object
8-
class AttributeDelegator < ActiveSupport::ProxyObject
8+
class AttributeDelegator < ::BasicObject
9+
undef_method :==
10+
undef_method :equal?
11+
912
def initialize(obj = nil, attribute = nil, cache: true, &block)
1013
@delegate_sd_attr = attribute
1114
@delegate_sd_obj = block.presence || obj
1215
@delegate_cache = cache
1316
end
1417

18+
def raise(*args)
19+
::Object.send(:raise, *args)
20+
end
21+
1522
private
1623

1724
def respond_to_missing?(method_name, include_private = false)

0 commit comments

Comments
 (0)