rspec-graphql_matchers 1.0.1 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e1b62f5a95d20257f842b982b96dee3ffbfd0ecdaebc39ce9dabbdce6fe6353
4
- data.tar.gz: ac281e27a9cd7a390ede1fbd2e45d508d62ea6438e343c80c2967aa2cd4d6b29
3
+ metadata.gz: 95bbde7e6185bd3338294aa487a1f3cfaa794e2f94203f610d3c23f43577a858
4
+ data.tar.gz: de25f9532825e473237eab0d711d2991b5553a01749e355d5479d98b5c9b0ce8
5
5
  SHA512:
6
- metadata.gz: c668b061318cdc940fc0045338163ea132271b508383ebc71eed113139b4286b25a275c68a5c90b21a8e4b25ae87227832dc33d021f218fe7322d01da87bb45f
7
- data.tar.gz: 7a6932601fc8bcf5d163bb0040d696b88d6dbc77c838a1dc25d9479accf23b470e25b72f93c4ddd07906e7a723f3bc003ef61f289a27f580951f3ec60de61dd4
6
+ metadata.gz: 98947628be39f759fadce2d0febff1761bf7027367bd82d402e9516e4f445d1eff3400bf1de485379949d1bb04a663d6c49e21cc40c293df1b5e8d3249cdaa22
7
+ data.tar.gz: 2bac7a4a9d4e1355da652cdd07b643c5741a7cfcc57bc7b4dfb1bce85bb0586b2f9c8072b9030bfecb8a84fbf91eef6c81f37b1d12fd14f821c088a55d54f04b
data/.travis.yml CHANGED
@@ -4,3 +4,9 @@ rvm:
4
4
  - 2.3.1
5
5
  before_install: gem install bundler -v 1.12.3
6
6
  script: bundle exec rspec
7
+ matrix:
8
+ include:
9
+ - name: "GraphQL 1.9.x"
10
+ env: GRAPHQL_GEM_VERSION=1.9
11
+ - name: "GraphQL 1.8.x"
12
+ env: GRAPHQL_GEM_VERSION=1.8
data/CHANGELOG.md CHANGED
@@ -8,6 +8,10 @@
8
8
 
9
9
  ### Bug fixes
10
10
 
11
+ ## 1.1 (Sep 19th, 2019)
12
+
13
+ - Added graphql-ruby 1.9.x support (thanks to @severin)
14
+
11
15
  ## 1.0.1 (June 22th, 2019)
12
16
 
13
17
  ### Bug fixes
data/Gemfile CHANGED
@@ -2,3 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rspec-graphql_matchers.gemspec
4
4
  gemspec
5
+
6
+ if ENV['GRAPHQL_GEM_VERSION'] == '1.8'
7
+ gem 'graphql', '~> 1.8.0'
8
+ elsif ENV['GRAPHQL_GEM_VERSION'] == '1.9'
9
+ gem 'graphql', '~> 1.9.0'
10
+ end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'base_matcher'
4
- require 'pry'
5
4
 
6
5
  module RSpec
7
6
  module GraphqlMatchers
@@ -19,6 +19,7 @@ module RSpec
19
19
  @graph_object = graph_object
20
20
 
21
21
  @actual_field = field_collection[@expected_field_name]
22
+ @actual_field = @actual_field.to_graphql if @actual_field.respond_to?(:to_graphql)
22
23
  return false if @actual_field.nil?
23
24
 
24
25
  @results = @expectations.reject do |matcher|
@@ -23,11 +23,10 @@ module RSpec
23
23
 
24
24
  def get_hash_key(actual_field)
25
25
  if actual_field.respond_to?(:hash_key)
26
- return actual_field.hash_key.to_sym
26
+ return actual_field.hash_key.to_sym if actual_field.hash_key
27
27
  end
28
28
 
29
- # Class-based api
30
- actual_field.method_sym
29
+ actual_field.metadata[:type_class].method_sym
31
30
  end
32
31
  end
33
32
  end
@@ -11,13 +11,21 @@ module RSpec
11
11
  end
12
12
 
13
13
  def matches?(actual_field)
14
- @actual_property = actual_field.property.to_sym
14
+ @actual_property = property(actual_field).to_sym
15
15
  @actual_property == @expected_property_name.to_sym
16
16
  end
17
17
 
18
18
  def failure_message
19
19
  "#{description}, but it was `#{@actual_property}`"
20
20
  end
21
+
22
+ private
23
+
24
+ def property(field)
25
+ property = field.property
26
+ property = field.metadata[:type_class].method_sym if property.nil?
27
+ property
28
+ end
21
29
  end
22
30
  end
23
31
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rspec
4
4
  module GraphqlMatchers
5
- VERSION = '1.0.1'
5
+ VERSION = '1.1'
6
6
  end
7
7
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ['lib']
27
27
 
28
- spec.add_runtime_dependency 'graphql', '>= 1.8', '< 1.9'
28
+ spec.add_runtime_dependency 'graphql', '>= 1.8', '< 2.0'
29
29
  spec.add_development_dependency 'bundler', '~> 1.12'
30
30
  spec.add_development_dependency 'rubocop', '0.71'
31
31
  spec.add_development_dependency 'rspec', '~> 3.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-graphql_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Brandão
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-22 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '1.8'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '1.9'
22
+ version: '2.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '1.8'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '1.9'
32
+ version: '2.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +121,6 @@ files:
121
121
  - lib/rspec/graphql_matchers/matchers.rb
122
122
  - lib/rspec/graphql_matchers/types_helper.rb
123
123
  - lib/rspec/graphql_matchers/version.rb
124
- - rspec-graphql_matchers-1.0.0.pre.0.1.gem
125
124
  - rspec-graphql_matchers.gemspec
126
125
  homepage: https://github.com/khamusa/rspec-graphql_matchers
127
126
  licenses: