Skip to content

Commit c7f0fb7

Browse files
committed
Find-and-replace assert_equal nil, -> assert_nil
1 parent b167d08 commit c7f0fb7

File tree

10 files changed

+22
-22
lines changed

10 files changed

+22
-22
lines changed

spec/graphql/execution/interpreter_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,8 @@ def execute_multiplex(multiplex:)
535535

536536
assert_equal 3, res["data"]["findMany"].size
537537
assert_equal "RAV", res["data"]["findMany"][0]["sym"]
538-
assert_equal nil, res["data"]["findMany"][1]
539-
assert_equal nil, res["data"]["findMany"][2]
538+
assert_nil res["data"]["findMany"][1]
539+
assert_nil res["data"]["findMany"][2]
540540
assert_equal false, res.key?("errors")
541541

542542
assert_equal Hash, res["data"].class

spec/graphql/schema/input_object_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
describe "type info" do
1818
it "has it" do
1919
assert_equal "EnsembleInput", input_object.graphql_name
20-
assert_equal nil, input_object.description
20+
assert_nil input_object.description
2121
assert_equal 1, input_object.arguments.size
2222
end
2323

spec/graphql/schema/member/has_arguments_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def add(left:, right:)
2323

2424
it "doesn't require authorization when arguments with default values aren't present in the query" do
2525
assert_equal 5, DefaultArgumentAuthSchema.execute("{ add(left: 3, right: 2) }", context: { is_authorized: true })["data"].fetch("add")
26-
assert_equal nil, DefaultArgumentAuthSchema.execute("{ add(left: 3, right: 2) }", context: { is_authorized: false })["data"].fetch("add")
26+
assert_nil DefaultArgumentAuthSchema.execute("{ add(left: 3, right: 2) }", context: { is_authorized: false })["data"].fetch("add")
2727
assert_equal 4, DefaultArgumentAuthSchema.execute("{ add(left: 3) }", context: { is_authorized: false })["data"].fetch("add")
2828
end
2929
end

spec/graphql/schema/resolver_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,21 +935,21 @@ def load_input(input); end
935935
it "preserves `nil` when nullable argument is provided `null`" do
936936
res = exec_query("mutation { mutationWithNullableLoadsArgument(labelId: null) { inputs } }")
937937

938-
assert_equal nil, res["errors"]
938+
assert_nil res["errors"]
939939
assert_equal '{"label":null}', res["data"]["mutationWithNullableLoadsArgument"]["inputs"]
940940
end
941941

942942
it "preserves `nil` when nullable list argument is provided `null`" do
943943
res = exec_query("mutation { mutationWithNullableLoadsArgument(labelIds: null) { inputs } }")
944944

945-
assert_equal nil, res["errors"]
945+
assert_nil res["errors"]
946946
assert_equal '{"labels":null}', res["data"]["mutationWithNullableLoadsArgument"]["inputs"]
947947
end
948948

949949
it "omits omitted nullable argument" do
950950
res = exec_query("mutation { mutationWithNullableLoadsArgument { inputs } }")
951951

952-
assert_equal nil, res["errors"]
952+
assert_nil res["errors"]
953953
assert_equal "{}", res["data"]["mutationWithNullableLoadsArgument"]["inputs"]
954954
end
955955

spec/graphql/schema/validator/allow_blank_validator_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
it "rejects blank by default" do
1616
schema = build_schema(String, {length: { minimum: 5 }})
1717
result = schema.execute("query($str: String) { validated(value: $str) }", variables: { str: ValidatorHelpers::BlankString.new })
18-
assert_equal nil, result["data"]["validated"]
18+
assert_nil result["data"]["validated"]
1919
assert_equal ["value is too short (minimum is 5)"], result["errors"].map { |e| e["message"] }
2020
end
2121

2222
it "can be used standalone" do
2323
schema = build_schema(String, { allow_blank: false })
2424
result = schema.execute("query($str: String) { validated(value: $str) }", variables: { str: ValidatorHelpers::BlankString.new })
25-
assert_equal nil, result["data"]["validated"]
25+
assert_nil result["data"]["validated"]
2626
assert_equal ["value can't be blank"], result["errors"].map { |e| e["message"] }
2727
end
2828
end

spec/graphql/schema/validator/allow_null_validator_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@
88
it "allows nil when permitted" do
99
schema = build_schema(String, {length: { minimum: 5 }, allow_null: true})
1010
result = schema.execute("query($str: String) { validated(value: $str) }", variables: { str: nil })
11-
assert_equal nil, result["data"]["validated"]
11+
assert_nil result["data"]["validated"]
1212
refute result.key?("errors")
1313
end
1414

1515
it "rejects null by default" do
1616
schema = build_schema(String, {length: { minimum: 5 }})
1717
result = schema.execute("query($str: String) { validated(value: $str) }", variables: { str: nil })
18-
assert_equal nil, result["data"]["validated"]
18+
assert_nil result["data"]["validated"]
1919
assert_equal ["value is too short (minimum is 5)"], result["errors"].map { |e| e["message"] }
2020
end
2121

2222
it "can be used standalone" do
2323
schema = build_schema(String, { allow_null: false })
2424
result = schema.execute("query($str: String) { validated(value: $str) }", variables: { str: nil })
25-
assert_equal nil, result["data"]["validated"]
25+
assert_nil result["data"]["validated"]
2626
assert_equal ["value can't be null"], result["errors"].map { |e| e["message"] }
2727
end
2828

2929
it "allows nil when no validations are configured" do
3030
schema = build_schema(String, {})
3131
result = schema.execute("query($str: String) { validated(value: $str) }", variables: { str: nil })
32-
assert_equal nil, result["data"]["validated"]
32+
assert_nil result["data"]["validated"]
3333
refute result.key?("errors")
3434

3535
result = schema.execute("query { validated }")
36-
assert_equal nil, result["data"]["validated"]
36+
assert_nil result["data"]["validated"]
3737
refute result.key?("errors")
3838
end
3939
end

spec/graphql/schema/validator/length_validator_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
schema = build_schema(String, {length: { minimum: 5 }, allow_null: true, allow_blank: false})
2222
result = schema.execute("{ validated(value: null) }")
23-
assert_equal nil, result["data"]["validated"]
23+
assert_nil result["data"]["validated"]
2424
refute result.key?("errors")
2525

2626
result = schema.execute("query($str: String!) { validated(value: $str) }", variables: { str: blank_string })

spec/graphql/subscriptions_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def str
736736
failedEvent(id: $id) { str, int }
737737
}
738738
GRAPHQL
739-
assert_equal nil, res["data"]
739+
assert_nil res["data"]
740740
assert_equal "unauthorized", res["errors"][0]["message"]
741741

742742
assert_equal 0, subscriptions_by_topic.size

spec/graphql/types/big_int_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
end
1919

2020
it "returns `nil` for invalid inputs" do
21-
assert_equal nil, GraphQL::Types::BigInt.coerce_input("xyz", nil)
22-
assert_equal nil, GraphQL::Types::BigInt.coerce_input("2.2", nil)
21+
assert_nil GraphQL::Types::BigInt.coerce_input("xyz", nil)
22+
assert_nil GraphQL::Types::BigInt.coerce_input("2.2", nil)
2323
end
2424

2525
it 'returns `nil` for nil' do
26-
assert_equal nil, GraphQL::Types::BigInt.coerce_input(nil, nil)
26+
assert_nil GraphQL::Types::BigInt.coerce_input(nil, nil)
2727
end
2828

2929
it 'parses integers with base 10' do

spec/integration/rails/graphql/types/iso_8601_duration_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def self.type_error(err, ctx)
1212

1313
let(:context) { GraphQL::Query.new(DurationTest::Schema, "{ __typename }").context }
1414

15-
# 3 years, 6 months, 4 days, 12 hours, 30 minutes, and 5.12345 seconds
15+
# 3 years, 6 months, 4 days, 12 hours, 30 minutes, and 5.12345 seconds
1616
let (:duration_str) { "P3Y6M4DT12H30M5.12345S" }
1717
let (:duration) { ActiveSupport::Duration.parse(duration_str) }
1818

@@ -67,7 +67,7 @@ def self.type_error(err, ctx)
6767

6868
describe "coercing nil" do
6969
it "returns nil" do
70-
assert_equal nil, GraphQL::Types::ISO8601Duration.coerce_input(nil, context)
70+
assert_nil GraphQL::Types::ISO8601Duration.coerce_input(nil, context)
7171
end
7272
end
7373

@@ -98,7 +98,7 @@ def self.type_error(err, ctx)
9898
it "coerce_result and coerce_input raise GraphQL::Error" do
9999
old_active_support = defined?(ActiveSupport) ? ActiveSupport : nil
100100
Object.send(:remove_const, :ActiveSupport) if defined?(ActiveSupport)
101-
101+
102102
assert_raises GraphQL::Error do
103103
GraphQL::Types::ISO8601Duration.coerce_result("", context)
104104
end

0 commit comments

Comments
 (0)