jsonapi-resources-matchers 0.3.0 → 0.4.0

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
  SHA1:
3
- metadata.gz: 9cf29e748e8ceb2c88f705e41606add289595519
4
- data.tar.gz: 8786354af24bb3c3e6b013f11f16014a39930b66
3
+ metadata.gz: 93bdae4ac60db2a61069a9fa95f46cdc5f74ae3a
4
+ data.tar.gz: b562aaabdb09a5b417e8d71d4637545035322075
5
5
  SHA512:
6
- metadata.gz: e941507f83a4c9537bd3c7a69716efa3b1faafd242c926c61ba93a0236109c022a4334701fd4e7e01995838ae1f127d256c57a250acc41a6f19dda9df0e91e43
7
- data.tar.gz: 1c5d9824e4024b1dd101aab935a19c4a918db045a76e40582e0c5e7fb4a6a33654a4ce2cf69636336aefc7a906605ca4b332177f6f125acf854455423683c162
6
+ metadata.gz: b7dc61e1d5ce3904fe96e66ce3ee6fc2b9d27f6874e9ee1ba2e30490417ec0b36db1fbc672bc6b7025af45fc41cef7648a848f4c070eb4ee9f4df306940ee08e
7
+ data.tar.gz: 57af4617abbe0a7d979136295ce6a1de03e5cc67f249ce2abee32378b9b5156ae5bce36e521113b5dd5296ae2a4a2d39c5b1285574aa83d794aaa8849a16feee
data/CHANGELOG.md CHANGED
@@ -1,12 +1,25 @@
1
- # v0.3.0
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
2
4
 
5
+ ## [0.4.0]
6
+ ### Changed
7
+ - Update jsonapi-resources dependency to `>= 0.6.0`
8
+
9
+ ### Fixed
10
+ - Use the key formatter JSONAPI resources is set to use https://github.com/G5/jsonapi-resources-matchers/pull/3
11
+
12
+ ## [0.3.0]
13
+ ### Added
3
14
  - Add `with_relation_name` to `have_many` matcher
4
- - Condense `HaveOne` and `HaveMany` into `Relationship`. No public API change.
5
15
 
6
- # v0.2.0
16
+ ### Changed
17
+ - Condense `HaveOne` and `HaveMany` into `Relationship`. No public API change.
7
18
 
19
+ ## [0.2.0]
20
+ ### Added
8
21
  - Add `have_one` matcher
9
22
 
10
- # v0.1.0
11
-
23
+ ## [0.1.0]
24
+ ### Added
12
25
  - Initial release
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015 G5
1
+ Copyright 2016 G5
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -37,9 +37,9 @@ end
37
37
 
38
38
  RSpec.describe Api::V1::BookResource, type: :resource do
39
39
  let(:book) { Book.new }
40
- subject { described_class.new(book) }
40
+ subject { described_class.new(book, {}) }
41
41
 
42
- it { is_expected.to use_primary_key :isbn }
42
+ it { is_expected.to have_primary_key :isbn }
43
43
  it { is_expected.to have_attribute :title }
44
44
  it { is_expected.to have_many(:readers).with_class_name("Person") }
45
45
  it { is_expected.to filter(:author_id) }
@@ -48,9 +48,8 @@ end
48
48
 
49
49
  ## Development
50
50
 
51
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
52
-
53
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
51
+ - in `spec/dummy`, run: `bundle exec rake db:migrate`
52
+ - in project dir, run tests: `rspec spec`
54
53
 
55
54
  ## Contributing
56
55
 
@@ -58,7 +57,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/g5/jso
58
57
 
59
58
  ## MIT License
60
59
 
61
- Copyright 2015 G5
60
+ Copyright 2016 G5
62
61
 
63
62
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
64
63
 
@@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_dependency "jsonapi-resources", ">= 0.5.0"
30
+ spec.add_dependency "jsonapi-resources", ">= 0.6.0"
31
31
 
32
32
  spec.add_development_dependency "bundler", "~> 1.10"
33
33
  spec.add_development_dependency "rake", "~> 10.0"
34
34
  spec.add_development_dependency "rspec"
35
- spec.add_development_dependency "rails"
35
+ spec.add_development_dependency "rails", "~> 4.0"
36
36
  end
@@ -16,7 +16,7 @@ module JSONAPI
16
16
 
17
17
  serialized_hash = JSONAPI::ResourceSerializer.new(resource_class).
18
18
  serialize_to_hash(resource).with_indifferent_access
19
- expected_key = name.to_s.dasherize
19
+ expected_key = JSONAPI.configuration.key_formatter.format(name.to_s)
20
20
  attributes = serialized_hash["data"]["attributes"]
21
21
  return false if attributes.nil?
22
22
  attributes.has_key?(expected_key)
@@ -33,7 +33,7 @@ module JSONAPI
33
33
  def has_key_in_relationships?
34
34
  serialized_hash = JSONAPI::ResourceSerializer.new(resource.class).
35
35
  serialize_to_hash(resource).with_indifferent_access
36
- expected_key = name.to_s.dasherize
36
+ expected_key = JSONAPI.configuration.key_formatter.format(name.to_s)
37
37
  relationships = serialized_hash["data"]["relationships"]
38
38
  return false if relationships.nil?
39
39
  relationships.has_key?(expected_key)
@@ -71,7 +71,7 @@ module JSONAPI
71
71
  def matches_relation_name?
72
72
  return true if self.expected_relation_name.nil?
73
73
  association = resource.class._relationships[name]
74
- actual_relation_name = association.relation_name
74
+ actual_relation_name = association.relation_name({})
75
75
  self.expected_relation_name == actual_relation_name
76
76
  end
77
77
 
@@ -1,7 +1,7 @@
1
1
  module JSONAPI
2
2
  module Resources
3
3
  module Matchers
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - G5
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-07-22 00:00:00.000000000 Z
12
+ date: 2016-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jsonapi-resources
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 0.5.0
20
+ version: 0.6.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 0.5.0
27
+ version: 0.6.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -71,16 +71,16 @@ dependencies:
71
71
  name: rails
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">="
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: '4.0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0'
83
+ version: '4.0'
84
84
  description: Spec matchers for jsonapi-resources
85
85
  email:
86
86
  - lateam@getg5.com
@@ -95,7 +95,6 @@ files:
95
95
  - CHANGELOG.md
96
96
  - CODE_OF_CONDUCT.md
97
97
  - Gemfile
98
- - LICENSE.txt
99
98
  - MIT-LICENSE
100
99
  - README.md
101
100
  - Rakefile
@@ -132,8 +131,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
131
  version: '0'
133
132
  requirements: []
134
133
  rubyforge_project:
135
- rubygems_version: 2.4.6
134
+ rubygems_version: 2.5.1
136
135
  signing_key:
137
136
  specification_version: 4
138
137
  summary: Spec matchers for jsonapi-resources
139
138
  test_files: []
139
+ has_rdoc:
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Ramon Tayag
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.