rspec-graphql_assistant 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rspec/graphql_assistant.rb +1 -0
- data/lib/rspec/graphql_assistant/matchers.rb +4 -0
- data/lib/rspec/graphql_assistant/matchers/have_attributes.rb +6 -0
- data/lib/rspec/graphql_assistant/matchers/match.rb +31 -0
- data/lib/rspec/graphql_assistant/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fc4cde9305072dd3bac0208c0fc11228d97d4a27828ece35679969a0a28c1d5
|
4
|
+
data.tar.gz: af9649a671483746fa46c8c39c445496bd234a07209c476f4da5d7a6df539b8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ead259808577447143f3a80d92b5183fd607a5c22601ffe20747bf0d1b36ada76ea97f62c9b51d368ff333cc9f02b7ce5588d8498c2edc38557dd31a7798cbf2
|
7
|
+
data.tar.gz: e1f339a418a75c366413d3b441a7af16a5a1b40e1cc56f006c34414e7dca9a383a3f3ef3cea551206bbed375c6f37caed213fdd39130aae06d8e01121b7fce46
|
data/Gemfile.lock
CHANGED
@@ -6,6 +6,7 @@ require 'active_support/core_ext'
|
|
6
6
|
require 'rspec/graphql_assistant/matchers/matcher_helper'
|
7
7
|
require 'rspec/graphql_assistant/matchers/include'
|
8
8
|
require 'rspec/graphql_assistant/matchers/have_attributes'
|
9
|
+
require 'rspec/graphql_assistant/matchers/match'
|
9
10
|
require 'rspec/graphql_assistant/matchers'
|
10
11
|
require 'rspec/graphql_assistant/query_builder'
|
11
12
|
require 'rspec/graphql_assistant/argument_builder'
|
@@ -14,6 +14,12 @@ module RSpec
|
|
14
14
|
|
15
15
|
def matches?(actual)
|
16
16
|
value = lookup_value(actual)
|
17
|
+
return expected_hash(value, expected) if expected.is_a?(Hash)
|
18
|
+
|
19
|
+
false
|
20
|
+
end
|
21
|
+
|
22
|
+
def expected_hash(value, expected)
|
17
23
|
res = true
|
18
24
|
expected.each do |k, v|
|
19
25
|
res = value[k] == v
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RSpec
|
2
|
+
module GraphqlAssistant
|
3
|
+
module Matchers
|
4
|
+
class Match
|
5
|
+
include MatcherHelper
|
6
|
+
|
7
|
+
attr_reader :sample, :expected, :key, :root
|
8
|
+
|
9
|
+
def initialize(key, expected, **args)
|
10
|
+
@key = key
|
11
|
+
@expected = expected
|
12
|
+
@root = args.fetch(:root, :data)
|
13
|
+
end
|
14
|
+
|
15
|
+
def matches?(actual)
|
16
|
+
value = lookup_value(actual)
|
17
|
+
|
18
|
+
value == expected
|
19
|
+
end
|
20
|
+
|
21
|
+
def failure_message
|
22
|
+
"'#{key}' not match '#{expected}'"
|
23
|
+
end
|
24
|
+
|
25
|
+
def description
|
26
|
+
"'#{key}' match '#{expected}'"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-graphql_assistant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Lopatin
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/rspec/graphql_assistant/matchers.rb
|
49
49
|
- lib/rspec/graphql_assistant/matchers/have_attributes.rb
|
50
50
|
- lib/rspec/graphql_assistant/matchers/include.rb
|
51
|
+
- lib/rspec/graphql_assistant/matchers/match.rb
|
51
52
|
- lib/rspec/graphql_assistant/matchers/matcher_helper.rb
|
52
53
|
- lib/rspec/graphql_assistant/query_builder.rb
|
53
54
|
- lib/rspec/graphql_assistant/response_builder.rb
|