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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adc1ae0ff51cd09b61d84afd36a6c28af5d62341a23c06804e95460717af5414
4
- data.tar.gz: 165f94dadbd1854d9eb16478221817a7bdb722b103861eadd671dd5049927961
3
+ metadata.gz: 5fc4cde9305072dd3bac0208c0fc11228d97d4a27828ece35679969a0a28c1d5
4
+ data.tar.gz: af9649a671483746fa46c8c39c445496bd234a07209c476f4da5d7a6df539b8d
5
5
  SHA512:
6
- metadata.gz: a7c012bab3cf51c944df522d759248ba7842db262f6694346d65785e48c02a23d23dd858c263f910d82c305087974824398a2aa1111cea27420f7ce7bf140baf
7
- data.tar.gz: a0c20a07b6b6353d95325a118623f5a56ad3025bbec6a29e4e4db8db8a87ae881e57f986153bd06aa7a6c11265899b2b99f62cab51af79f54dd0c090b4260a3a
6
+ metadata.gz: ead259808577447143f3a80d92b5183fd607a5c22601ffe20747bf0d1b36ada76ea97f62c9b51d368ff333cc9f02b7ce5588d8498c2edc38557dd31a7798cbf2
7
+ data.tar.gz: e1f339a418a75c366413d3b441a7af16a5a1b40e1cc56f006c34414e7dca9a383a3f3ef3cea551206bbed375c6f37caed213fdd39130aae06d8e01121b7fce46
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-graphql_assistant (0.1.2)
4
+ rspec-graphql_assistant (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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'
@@ -7,5 +7,9 @@ module RSpec
7
7
  def graphql_have_attributes(key, expected)
8
8
  RSpec::GraphqlAssistant::Matchers::HaveAttributes.new(key, expected)
9
9
  end
10
+
11
+ def graphql_match(key, expected)
12
+ RSpec::GraphqlAssistant::Matchers::Match.new(key, expected)
13
+ end
10
14
  end
11
15
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module GraphqlAssistant
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  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.3
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