Skip to content

Commit 8a471af

Browse files
committed
Fix test on mongo gemfiles, rework input object spec to avoid stack overflow
1 parent a38a01a commit 8a471af

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

spec/graphql/deprecation_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "spec_helper"
44

55
describe GraphQL::Deprecation do
6-
if testing_rails?
6+
if defined?(ActiveSupport)
77
it "uses ActiveSupport::Deprecation.warn when it's available" do
88
ActiveSupport::Deprecation.stub :warn, :was_warned do
99
assert_equal :was_warned, GraphQL::Deprecation.warn("abcd")

spec/graphql/schema/input_object_spec.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -653,17 +653,12 @@ class TestInput2 < GraphQL::Schema::InputObject
653653
end
654654

655655
expected_warning = "Unable to define a helper for argument with name 'method' as this is a reserved name. Add `method_access: false` to stop this warning."
656-
if testing_rails?
657-
rails_caller = if Rails::VERSION::STRING < "5"
658-
"(called from warn at #{Dir.pwd}/lib/graphql/deprecation.rb:7)"
659-
else
660-
"(called from block (3 levels) in construct_arguments_class at #{Dir.pwd}/lib/graphql/query/arguments.rb:25)"
661-
end
662-
expected_warning = "DEPRECATION WARNING: #{expected_warning} #{rails_caller}"
663-
end
664-
assert_output "", expected_warning + "\n" do
656+
657+
messages = []
658+
GraphQL::Deprecation.stub(:warn, ->(message) { messages << message; nil }) do
665659
input_object.graphql_definition
666660
end
661+
assert_equal [expected_warning], messages
667662
end
668663

669664
it "doesn't warn with `method_access: false`" do

0 commit comments

Comments
 (0)