rspec-json_api 1.5.0 → 1.6.0
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/CHANGELOG.md +23 -1
- data/README.md +4 -3
- data/lib/rspec/json_api/constraints.rb +2 -0
- data/lib/rspec/json_api/matchers/match_json_schema.rb +22 -1
- data/lib/rspec/json_api/schema_match.rb +30 -3
- data/lib/rspec/json_api/types/uri.rb +5 -1
- data/lib/rspec/json_api/version.rb +1 -1
- metadata +2 -20
- data/.gitattributes +0 -28
- data/.github/workflows/main.yml +0 -45
- data/.gitignore +0 -17
- data/.rspec +0 -3
- data/.rubocop.yml +0 -41
- data/.ruby-version +0 -1
- data/CODE_OF_CONDUCT.md +0 -84
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -182
- data/Rakefile +0 -12
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/gemfiles/rails_6_1.gemfile +0 -7
- data/gemfiles/rails_7_1.gemfile +0 -7
- data/gemfiles/rails_7_2.gemfile +0 -7
- data/gemfiles/rails_8_0.gemfile +0 -7
- data/gemfiles/rails_8_1.gemfile +0 -7
- data/rspec-json_api.gemspec +0 -42
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b0a09137349ac0fccf09529e902891d26148b10533b62c4d8f7731ba7529b5a3
|
|
4
|
+
data.tar.gz: 79217a3491fb7c081f86b38305574ba201d7710572312f406edb55a939dee8fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d50831bc5a1ea49bd7579524db9f61879f7568982953c1f449a4daa1a2a67b3d2a052a04e079c2bafc140832868497014bfded996d860aa60aa47b03a8f0db9e
|
|
7
|
+
data.tar.gz: 2296ba594e1acf7f9cca856386ac963ec46b0a72b286d50a38a830f3f39ed12b585ee39274af1baf56863f138d84d250820be594ea9868caddbec0a65f139e32
|
data/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.6.0] - 2026-09-03
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- A list schema (`[String]`, `[INTERFACE]`) fails the match instead of raising `NoMethodError` when the response holds `null` or a scalar where an array was expected. This affected nested lists too, so an interface element with a scalar in place of a list crashed the example.
|
|
7
|
+
- `Types::URI` is anchored with `\A...\z`. It previously accepted any value that merely contained a URI, so `"see https://example.com for details"` matched. `EMAIL` and `UUID` were already anchored. Suites that relied on the substring behaviour will start failing.
|
|
8
|
+
- `match_json_schema` fails with `expected a JSON String to match against the schema, got NilClass` instead of raising `TypeError` when handed `nil`, an already-parsed Hash, or any other non-String.
|
|
9
|
+
- A schema `Proc` that returns something other than an options Hash, or that expects the value as an argument, raises a descriptive `ArgumentError` naming the mistake. Both previously surfaced as a bare `NoMethodError` or `wrong number of arguments` from inside the matcher.
|
|
10
|
+
- An object schema compared against array elements of another shape (`[{ id: Integer }]` against `["a", "b"]`) fails instead of raising `NoMethodError`. This is the same class of bug as the list-schema crash above, on the object comparison path.
|
|
11
|
+
- `expect(body).not_to match_json_schema(schema)` fails when the body is not a JSON String, rather than passing by default. A type error in the spec is now a failure whichever way the expectation is written.
|
|
12
|
+
- A non-lambda `proc { |value| ... }` used as a schema Proc is rejected alongside the lambda form. Ruby reports a non-lambda block parameter as optional, so the check reads the parameter list rather than the arity; a Proc declaring an optional parameter is rejected for the same reason.
|
|
13
|
+
- The `have_no_content` specs gave every body its own context. A repeated `let(:actual)` in one context meant the `"{}"` case never ran.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- The released gem contains the tracked files under `lib/` plus the licence, the README and the CHANGELOG, and nothing else. It previously packaged the repository's own tooling: the CI workflow, the RuboCop config, the Gemfile and lockfile, the Rakefile, `bin/` and `gemfiles/`. Scoping the file list to tracked paths also keeps an untracked local file in `lib/` out of a release.
|
|
17
|
+
- README regex examples anchor with `\A` and `\z` instead of `^` and `$`, with a note explaining that the line-boundary anchors let a multi-line value satisfy a schema.
|
|
18
|
+
- Updated the locked development dependencies past every advisory `bundler-audit` reported: rack, nokogiri, railties, activesupport, concurrent-ruby, loofah, crass, erb, json, rails-html-sanitizer and rack-session.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- Exact-array schemas dispatch each element the same way any other schema value is dispatched, so `[Integer, Integer]` is a fixed-length tuple and `[RSpec::JsonApi::Types::URI]` type-checks its single element. Elements were previously compared with `==`, so a Class, Regexp or Proc in that position could never match.
|
|
22
|
+
- A `bundler-audit` job in CI, a Dependabot config for bundler and github-actions, and `permissions: contents: read` on the workflow.
|
|
23
|
+
- `ROADMAP.md`, the prioritised findings from a full review of the codebase.
|
|
24
|
+
|
|
3
25
|
## [1.5.0] - 2026-06-05
|
|
4
26
|
|
|
5
27
|
### Added
|
|
6
|
-
- CI compatibility matrix across Ruby 3.2
|
|
28
|
+
- CI compatibility matrix across Ruby 3.2-3.4 and Rails 6.1, 7.1, 7.2, 8.0 and 8.1 (`gemfiles/` + GitHub Actions matrix), so the advertised version support is actually tested.
|
|
7
29
|
- `RSpec::JsonApi::Constraints` module encapsulating the schema `Proc` options DSL.
|
|
8
30
|
- `RSpec::JsonApi::SchemaMatch` as the single comparison entry point, and `RSpec::JsonApi::Traversal` for the internal structural helpers.
|
|
9
31
|
|
data/README.md
CHANGED
|
@@ -55,7 +55,7 @@ RSpec.describe UsersController, type: :controller do
|
|
|
55
55
|
id: RSpec::JsonApi::Types::UUID,
|
|
56
56
|
name: String,
|
|
57
57
|
age: Integer,
|
|
58
|
-
favoriteColorHex:
|
|
58
|
+
favoriteColorHex: /\A\#([a-fA-F]|[0-9]){3,6}\z/,
|
|
59
59
|
number: -> { { type: Integer, min: 10, max: 20, lambda: lambda(&:even?) } }
|
|
60
60
|
}]
|
|
61
61
|
end
|
|
@@ -133,7 +133,7 @@ Custom type example:
|
|
|
133
133
|
module RSpec
|
|
134
134
|
module JsonApi
|
|
135
135
|
module Types
|
|
136
|
-
COLOR_HEX =
|
|
136
|
+
COLOR_HEX = /\A#(?:[0-9a-fA-F]{3}){1,2}\z/
|
|
137
137
|
end
|
|
138
138
|
end
|
|
139
139
|
end
|
|
@@ -223,10 +223,11 @@ end
|
|
|
223
223
|
```ruby
|
|
224
224
|
let(:expected_schema) do
|
|
225
225
|
{
|
|
226
|
-
color:
|
|
226
|
+
color: /\A\#([a-fA-F]|[0-9]){3,6}\z/
|
|
227
227
|
}
|
|
228
228
|
end
|
|
229
229
|
```
|
|
230
|
+
_Note: anchor with `\A` and `\z`, not `^` and `$`. `^` and `$` match at line boundaries, so `/^\#[0-9a-fA-F]{3}$/` also accepts `"not a color\n#FFF"` and the value only has to contain a matching line for the schema to pass. The built-in `EMAIL`, `URI` and `UUID` types are anchored this way._
|
|
230
231
|
|
|
231
232
|
### Interface match
|
|
232
233
|
```ruby
|
|
@@ -24,6 +24,11 @@ module RSpec
|
|
|
24
24
|
# @return [Boolean] true if the actual JSON matches the expected schema, false otherwise.
|
|
25
25
|
def matches?(actual)
|
|
26
26
|
@diff = nil
|
|
27
|
+
@actual = actual
|
|
28
|
+
@type_error = !actual.is_a?(String)
|
|
29
|
+
|
|
30
|
+
return false if @type_error
|
|
31
|
+
|
|
27
32
|
@actual = JSON.parse(actual, symbolize_names: true)
|
|
28
33
|
|
|
29
34
|
RSpec::JsonApi::SchemaMatch.match(@actual, expected)
|
|
@@ -32,9 +37,19 @@ module RSpec
|
|
|
32
37
|
false
|
|
33
38
|
end
|
|
34
39
|
|
|
40
|
+
# A non-String actual is a mistake in the spec rather than a fact about the
|
|
41
|
+
# response, so the negated form has to fail rather than pass by default.
|
|
42
|
+
# @param actual [String] The JSON string to test against the expected schema.
|
|
43
|
+
# @return [Boolean] true if the actual JSON does not match the expected schema.
|
|
44
|
+
def does_not_match?(actual)
|
|
45
|
+
!matches?(actual) && !@type_error
|
|
46
|
+
end
|
|
47
|
+
|
|
35
48
|
# Provides a failure message for when the JSON data does not match the expected schema.
|
|
36
49
|
# @return [String] A descriptive message detailing the mismatch between expected and actual JSON.
|
|
37
50
|
def failure_message
|
|
51
|
+
return type_error_message if @type_error
|
|
52
|
+
|
|
38
53
|
<<~MSG
|
|
39
54
|
expected: #{expected}
|
|
40
55
|
got: #{actual}
|
|
@@ -46,8 +61,10 @@ module RSpec
|
|
|
46
61
|
|
|
47
62
|
# Provides a failure message for when the JSON data matches the expected schema, but it was expected not to.
|
|
48
63
|
# This is used in negative matchers.
|
|
49
|
-
# @return [
|
|
64
|
+
# @return [String] A descriptive message indicating the JSON was expected not to match the schema.
|
|
50
65
|
def failure_message_when_negated
|
|
66
|
+
return type_error_message if @type_error
|
|
67
|
+
|
|
51
68
|
"expected the JSON data not to match the provided schema, but it did."
|
|
52
69
|
end
|
|
53
70
|
|
|
@@ -58,6 +75,10 @@ module RSpec
|
|
|
58
75
|
def diff
|
|
59
76
|
@diff ||= Diffy::Diff.new(expected, actual, context: 5)
|
|
60
77
|
end
|
|
78
|
+
|
|
79
|
+
def type_error_message
|
|
80
|
+
"expected a JSON String to match against the schema, got #{actual.class}"
|
|
81
|
+
end
|
|
61
82
|
end
|
|
62
83
|
end
|
|
63
84
|
end
|
|
@@ -33,6 +33,7 @@ module RSpec
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def compare(actual, expected)
|
|
36
|
+
return false unless actual.is_a?(Hash)
|
|
36
37
|
return false if actual.blank? && expected.present?
|
|
37
38
|
|
|
38
39
|
keys = Traversal.deep_key_paths(expected) | Traversal.deep_key_paths(actual)
|
|
@@ -79,11 +80,37 @@ module RSpec
|
|
|
79
80
|
expected_value.match?(actual_value.to_s)
|
|
80
81
|
end
|
|
81
82
|
|
|
83
|
+
# A schema Proc describes the constraints for a value; it is called without
|
|
84
|
+
# arguments and must return the option Hash. A Proc that expects the value
|
|
85
|
+
# as an argument is a common misreading of the DSL, and calling it here
|
|
86
|
+
# would raise a bare "wrong number of arguments" from deep in the matcher.
|
|
82
87
|
def compare_proc(actual_value, expected_value)
|
|
83
|
-
|
|
88
|
+
if declares_value_parameter?(expected_value)
|
|
89
|
+
raise ArgumentError,
|
|
90
|
+
"schema Proc must take no arguments; " \
|
|
91
|
+
"write -> { { lambda: ->(value) { ... } } } to test the value itself"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
options = expected_value.call
|
|
95
|
+
raise ArgumentError, "schema Proc must return an options Hash, got #{options.class}" unless options.is_a?(Hash)
|
|
96
|
+
|
|
97
|
+
Constraints.match(actual_value, options)
|
|
84
98
|
end
|
|
85
99
|
|
|
100
|
+
# A non-lambda Proc reports its block parameters as optional, so
|
|
101
|
+
# `proc { |value| ... }` has to be caught on the parameter list rather
|
|
102
|
+
# than on arity. A bare splat states no expectation and is left alone.
|
|
103
|
+
def declares_value_parameter?(callable)
|
|
104
|
+
callable.parameters.any? { |type, _name| %i[req opt keyreq].include?(type) }
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# A list schema only ever matches an actual Array. Without this guard the
|
|
108
|
+
# branches below call Array methods on whatever the response contained, so
|
|
109
|
+
# a null or a scalar where a list was expected raised NoMethodError
|
|
110
|
+
# instead of failing the match.
|
|
86
111
|
def compare_array(actual_value, expected_value)
|
|
112
|
+
return false unless actual_value.is_a?(Array)
|
|
113
|
+
|
|
87
114
|
if simple_type?(expected_value)
|
|
88
115
|
compare_typed_array(actual_value, expected_value)
|
|
89
116
|
elsif interface?(expected_value)
|
|
@@ -112,10 +139,10 @@ module RSpec
|
|
|
112
139
|
|
|
113
140
|
# Any other array => element-by-element match, sizes must be equal.
|
|
114
141
|
def compare_exact_array(actual_value, expected_value)
|
|
115
|
-
return false if actual_value
|
|
142
|
+
return false if actual_value.size != expected_value.size
|
|
116
143
|
|
|
117
144
|
expected_value.each_with_index.all? do |elem, index|
|
|
118
|
-
elem.is_a?(Hash) ? compare(actual_value[index], elem) :
|
|
145
|
+
elem.is_a?(Hash) ? compare(actual_value[index], elem) : compare_values(actual_value[index], elem)
|
|
119
146
|
end
|
|
120
147
|
end
|
|
121
148
|
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
module RSpec
|
|
4
4
|
module JsonApi
|
|
5
5
|
module Types
|
|
6
|
-
|
|
6
|
+
# URI::DEFAULT_PARSER.make_regexp is unanchored, and comparison uses
|
|
7
|
+
# Regexp#match?, so on its own it accepts any string that merely contains
|
|
8
|
+
# a URI ("see https://example.com for details"). \A...\z holds the whole
|
|
9
|
+
# value to the pattern, the same way EMAIL and UUID already are anchored.
|
|
10
|
+
URI = /\A#{::URI::DEFAULT_PARSER.make_regexp}\z/
|
|
7
11
|
end
|
|
8
12
|
end
|
|
9
13
|
end
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-json_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michal Gajowiak
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
@@ -71,26 +71,9 @@ executables: []
|
|
|
71
71
|
extensions: []
|
|
72
72
|
extra_rdoc_files: []
|
|
73
73
|
files:
|
|
74
|
-
- ".gitattributes"
|
|
75
|
-
- ".github/workflows/main.yml"
|
|
76
|
-
- ".gitignore"
|
|
77
|
-
- ".rspec"
|
|
78
|
-
- ".rubocop.yml"
|
|
79
|
-
- ".ruby-version"
|
|
80
74
|
- CHANGELOG.md
|
|
81
|
-
- CODE_OF_CONDUCT.md
|
|
82
|
-
- Gemfile
|
|
83
|
-
- Gemfile.lock
|
|
84
75
|
- LICENSE.txt
|
|
85
76
|
- README.md
|
|
86
|
-
- Rakefile
|
|
87
|
-
- bin/console
|
|
88
|
-
- bin/setup
|
|
89
|
-
- gemfiles/rails_6_1.gemfile
|
|
90
|
-
- gemfiles/rails_7_1.gemfile
|
|
91
|
-
- gemfiles/rails_7_2.gemfile
|
|
92
|
-
- gemfiles/rails_8_0.gemfile
|
|
93
|
-
- gemfiles/rails_8_1.gemfile
|
|
94
77
|
- lib/generators/rspec/json_api/install/install_generator.rb
|
|
95
78
|
- lib/generators/rspec/json_api/install/templates/rspec/json_api/interfaces/.empty_directory
|
|
96
79
|
- lib/generators/rspec/json_api/install/templates/rspec/json_api/types/.empty_directory
|
|
@@ -108,7 +91,6 @@ files:
|
|
|
108
91
|
- lib/rspec/json_api/types/uri.rb
|
|
109
92
|
- lib/rspec/json_api/types/uuid.rb
|
|
110
93
|
- lib/rspec/json_api/version.rb
|
|
111
|
-
- rspec-json_api.gemspec
|
|
112
94
|
homepage: https://github.com/nomtek/rspec-json_api
|
|
113
95
|
licenses:
|
|
114
96
|
- MIT
|
data/.gitattributes
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Set default line ending behavior for all files
|
|
2
|
-
* text=lf
|
|
3
|
-
|
|
4
|
-
# Explicitly declare text files you want to always be normalized and converted
|
|
5
|
-
# to native line endings on checkout.
|
|
6
|
-
*.rb text=lf
|
|
7
|
-
*.rake text=lf
|
|
8
|
-
*.gemspec text=lf
|
|
9
|
-
Gemfile text=lf
|
|
10
|
-
Gemfile.lock text=lf
|
|
11
|
-
Rakefile text=lf
|
|
12
|
-
*.md text=lf
|
|
13
|
-
*.yml text=lf
|
|
14
|
-
*.yaml text=lf
|
|
15
|
-
*.json text=lf
|
|
16
|
-
*.txt text=lf
|
|
17
|
-
*.sh text=lf
|
|
18
|
-
|
|
19
|
-
# Denote all files that are truly binary and should not be modified.
|
|
20
|
-
*.png binary
|
|
21
|
-
*.jpg binary
|
|
22
|
-
*.jpeg binary
|
|
23
|
-
*.gif binary
|
|
24
|
-
*.ico binary
|
|
25
|
-
*.pdf binary
|
|
26
|
-
*.zip binary
|
|
27
|
-
*.tar binary
|
|
28
|
-
*.gz binary
|
data/.github/workflows/main.yml
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
name: Ruby
|
|
2
|
-
|
|
3
|
-
on: [push, pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
test:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
name: "rspec — Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}"
|
|
9
|
-
strategy:
|
|
10
|
-
fail-fast: false
|
|
11
|
-
matrix:
|
|
12
|
-
# Covers the supported range from the floor (Ruby 3.2 / Rails 6.1) to
|
|
13
|
-
# the current ceiling (Ruby 3.4 / Rails 8.1). Curated pairs avoid
|
|
14
|
-
# Ruby/Rails combinations that are not mutually supported.
|
|
15
|
-
include:
|
|
16
|
-
- { ruby: "3.2", gemfile: rails_6_1 }
|
|
17
|
-
- { ruby: "3.2", gemfile: rails_7_1 }
|
|
18
|
-
- { ruby: "3.3", gemfile: rails_7_2 }
|
|
19
|
-
- { ruby: "3.3", gemfile: rails_8_0 }
|
|
20
|
-
- { ruby: "3.4", gemfile: rails_8_0 }
|
|
21
|
-
- { ruby: "3.4", gemfile: rails_8_1 }
|
|
22
|
-
env:
|
|
23
|
-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
|
24
|
-
steps:
|
|
25
|
-
- uses: actions/checkout@v4
|
|
26
|
-
- name: Set up Ruby
|
|
27
|
-
uses: ruby/setup-ruby@v1
|
|
28
|
-
with:
|
|
29
|
-
ruby-version: ${{ matrix.ruby }}
|
|
30
|
-
bundler-cache: true
|
|
31
|
-
- name: Run rspec
|
|
32
|
-
run: bundle exec rspec
|
|
33
|
-
|
|
34
|
-
lint:
|
|
35
|
-
runs-on: ubuntu-latest
|
|
36
|
-
name: rubocop
|
|
37
|
-
steps:
|
|
38
|
-
- uses: actions/checkout@v4
|
|
39
|
-
- name: Set up Ruby
|
|
40
|
-
uses: ruby/setup-ruby@v1
|
|
41
|
-
with:
|
|
42
|
-
ruby-version: "3.2"
|
|
43
|
-
bundler-cache: true
|
|
44
|
-
- name: Run rubocop
|
|
45
|
-
run: bundle exec rubocop
|
data/.gitignore
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/.bundle/
|
|
2
|
-
/.yardoc
|
|
3
|
-
/_yardoc/
|
|
4
|
-
/coverage/
|
|
5
|
-
/doc/
|
|
6
|
-
/pkg/
|
|
7
|
-
/spec/reports/
|
|
8
|
-
/tmp/
|
|
9
|
-
|
|
10
|
-
# rspec failure tracking
|
|
11
|
-
.rspec_status
|
|
12
|
-
|
|
13
|
-
# built gem files
|
|
14
|
-
*.gem
|
|
15
|
-
|
|
16
|
-
# per-appraisal lockfiles (resolved fresh in CI)
|
|
17
|
-
gemfiles/*.gemfile.lock
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Append to (rather than replace) RuboCop's default AllCops/Exclude, so the
|
|
2
|
-
# defaults such as vendor/**/* stay excluded. Without this, CI installs gems
|
|
3
|
-
# into vendor/bundle (bundler-cache) and RuboCop would lint third-party gems.
|
|
4
|
-
inherit_mode:
|
|
5
|
-
merge:
|
|
6
|
-
- Exclude
|
|
7
|
-
|
|
8
|
-
AllCops:
|
|
9
|
-
TargetRubyVersion: 3.2
|
|
10
|
-
NewCops: enable
|
|
11
|
-
SuggestExtensions: false
|
|
12
|
-
Exclude:
|
|
13
|
-
- "README.md"
|
|
14
|
-
- "vendor/**/*"
|
|
15
|
-
- "gemfiles/vendor/**/*"
|
|
16
|
-
|
|
17
|
-
Style/StringLiterals:
|
|
18
|
-
Enabled: true
|
|
19
|
-
EnforcedStyle: double_quotes
|
|
20
|
-
|
|
21
|
-
Style/StringLiteralsInInterpolation:
|
|
22
|
-
Enabled: true
|
|
23
|
-
EnforcedStyle: double_quotes
|
|
24
|
-
|
|
25
|
-
Layout/LineLength:
|
|
26
|
-
Max: 120
|
|
27
|
-
|
|
28
|
-
Metrics/BlockLength:
|
|
29
|
-
Exclude:
|
|
30
|
-
- "spec/**/*_spec.rb"
|
|
31
|
-
|
|
32
|
-
Style/Documentation:
|
|
33
|
-
Enabled: false
|
|
34
|
-
|
|
35
|
-
Naming/PredicatePrefix:
|
|
36
|
-
Exclude:
|
|
37
|
-
- "lib/rspec/json_api/matchers.rb"
|
|
38
|
-
|
|
39
|
-
Naming/PredicateMethod:
|
|
40
|
-
Exclude:
|
|
41
|
-
- "lib/rspec/json_api/schema_match.rb"
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.2.2
|
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
-
|
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
-
|
|
9
|
-
## Our Standards
|
|
10
|
-
|
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
-
|
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
-
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
-
|
|
19
|
-
Examples of unacceptable behavior include:
|
|
20
|
-
|
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or
|
|
22
|
-
advances of any kind
|
|
23
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
-
* Public or private harassment
|
|
25
|
-
* Publishing others' private information, such as a physical or email
|
|
26
|
-
address, without their explicit permission
|
|
27
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
28
|
-
professional setting
|
|
29
|
-
|
|
30
|
-
## Enforcement Responsibilities
|
|
31
|
-
|
|
32
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
33
|
-
|
|
34
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
35
|
-
|
|
36
|
-
## Scope
|
|
37
|
-
|
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
39
|
-
|
|
40
|
-
## Enforcement
|
|
41
|
-
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at m.gajowiak@nomtek.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
43
|
-
|
|
44
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
45
|
-
|
|
46
|
-
## Enforcement Guidelines
|
|
47
|
-
|
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
49
|
-
|
|
50
|
-
### 1. Correction
|
|
51
|
-
|
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
53
|
-
|
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
55
|
-
|
|
56
|
-
### 2. Warning
|
|
57
|
-
|
|
58
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
|
59
|
-
|
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
61
|
-
|
|
62
|
-
### 3. Temporary Ban
|
|
63
|
-
|
|
64
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
65
|
-
|
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
67
|
-
|
|
68
|
-
### 4. Permanent Ban
|
|
69
|
-
|
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
71
|
-
|
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
73
|
-
|
|
74
|
-
## Attribution
|
|
75
|
-
|
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
|
77
|
-
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
78
|
-
|
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
|
80
|
-
|
|
81
|
-
[homepage]: https://www.contributor-covenant.org
|
|
82
|
-
|
|
83
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Bundler version: 4.0.4 (see Gemfile.lock BUNDLED WITH section)
|
|
4
|
-
source "https://rubygems.org"
|
|
5
|
-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
6
|
-
|
|
7
|
-
# Specify your gem's dependencies in rspec-json_api.gemspec
|
|
8
|
-
gemspec
|
|
9
|
-
|
|
10
|
-
gem "activesupport", ">= 6.1.4.1"
|
|
11
|
-
gem "diffy", "~> 3.4"
|
|
12
|
-
gem "rake", "~> 13.2"
|
|
13
|
-
gem "rspec-rails", ">= 5.0.2"
|
|
14
|
-
gem "rubocop", "~> 1.65"
|
data/Gemfile.lock
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
rspec-json_api (1.5.0)
|
|
5
|
-
activesupport (>= 6.1.4.1)
|
|
6
|
-
diffy (>= 3.4.2)
|
|
7
|
-
railties (>= 6.1.4.1)
|
|
8
|
-
rspec-rails (>= 5.0.2)
|
|
9
|
-
|
|
10
|
-
GEM
|
|
11
|
-
remote: https://rubygems.org/
|
|
12
|
-
specs:
|
|
13
|
-
actionpack (8.1.2)
|
|
14
|
-
actionview (= 8.1.2)
|
|
15
|
-
activesupport (= 8.1.2)
|
|
16
|
-
nokogiri (>= 1.8.5)
|
|
17
|
-
rack (>= 2.2.4)
|
|
18
|
-
rack-session (>= 1.0.1)
|
|
19
|
-
rack-test (>= 0.6.3)
|
|
20
|
-
rails-dom-testing (~> 2.2)
|
|
21
|
-
rails-html-sanitizer (~> 1.6)
|
|
22
|
-
useragent (~> 0.16)
|
|
23
|
-
actionview (8.1.2)
|
|
24
|
-
activesupport (= 8.1.2)
|
|
25
|
-
builder (~> 3.1)
|
|
26
|
-
erubi (~> 1.11)
|
|
27
|
-
rails-dom-testing (~> 2.2)
|
|
28
|
-
rails-html-sanitizer (~> 1.6)
|
|
29
|
-
activesupport (8.1.2)
|
|
30
|
-
base64
|
|
31
|
-
bigdecimal
|
|
32
|
-
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
33
|
-
connection_pool (>= 2.2.5)
|
|
34
|
-
drb
|
|
35
|
-
i18n (>= 1.6, < 2)
|
|
36
|
-
json
|
|
37
|
-
logger (>= 1.4.2)
|
|
38
|
-
minitest (>= 5.1)
|
|
39
|
-
securerandom (>= 0.3)
|
|
40
|
-
tzinfo (~> 2.0, >= 2.0.5)
|
|
41
|
-
uri (>= 0.13.1)
|
|
42
|
-
ast (2.4.3)
|
|
43
|
-
base64 (0.3.0)
|
|
44
|
-
bigdecimal (4.0.1)
|
|
45
|
-
builder (3.3.0)
|
|
46
|
-
concurrent-ruby (1.3.6)
|
|
47
|
-
connection_pool (3.0.2)
|
|
48
|
-
crass (1.0.6)
|
|
49
|
-
date (3.5.1)
|
|
50
|
-
diff-lcs (1.6.2)
|
|
51
|
-
diffy (3.4.4)
|
|
52
|
-
drb (2.2.3)
|
|
53
|
-
erb (6.0.1)
|
|
54
|
-
erubi (1.13.1)
|
|
55
|
-
i18n (1.14.8)
|
|
56
|
-
concurrent-ruby (~> 1.0)
|
|
57
|
-
io-console (0.8.2)
|
|
58
|
-
irb (1.16.0)
|
|
59
|
-
pp (>= 0.6.0)
|
|
60
|
-
rdoc (>= 4.0.0)
|
|
61
|
-
reline (>= 0.4.2)
|
|
62
|
-
json (2.18.0)
|
|
63
|
-
language_server-protocol (3.17.0.5)
|
|
64
|
-
lint_roller (1.1.0)
|
|
65
|
-
logger (1.7.0)
|
|
66
|
-
loofah (2.25.0)
|
|
67
|
-
crass (~> 1.0.2)
|
|
68
|
-
nokogiri (>= 1.12.0)
|
|
69
|
-
minitest (6.0.1)
|
|
70
|
-
prism (~> 1.5)
|
|
71
|
-
nokogiri (1.19.0-arm64-darwin)
|
|
72
|
-
racc (~> 1.4)
|
|
73
|
-
nokogiri (1.19.0-x86_64-darwin)
|
|
74
|
-
racc (~> 1.4)
|
|
75
|
-
nokogiri (1.19.0-x86_64-linux-gnu)
|
|
76
|
-
racc (~> 1.4)
|
|
77
|
-
parallel (1.27.0)
|
|
78
|
-
parser (3.3.10.1)
|
|
79
|
-
ast (~> 2.4.1)
|
|
80
|
-
racc
|
|
81
|
-
pp (0.6.3)
|
|
82
|
-
prettyprint
|
|
83
|
-
prettyprint (0.2.0)
|
|
84
|
-
prism (1.8.0)
|
|
85
|
-
psych (5.3.1)
|
|
86
|
-
date
|
|
87
|
-
stringio
|
|
88
|
-
racc (1.8.1)
|
|
89
|
-
rack (3.2.4)
|
|
90
|
-
rack-session (2.1.1)
|
|
91
|
-
base64 (>= 0.1.0)
|
|
92
|
-
rack (>= 3.0.0)
|
|
93
|
-
rack-test (2.2.0)
|
|
94
|
-
rack (>= 1.3)
|
|
95
|
-
rackup (2.3.1)
|
|
96
|
-
rack (>= 3)
|
|
97
|
-
rails-dom-testing (2.3.0)
|
|
98
|
-
activesupport (>= 5.0.0)
|
|
99
|
-
minitest
|
|
100
|
-
nokogiri (>= 1.6)
|
|
101
|
-
rails-html-sanitizer (1.6.2)
|
|
102
|
-
loofah (~> 2.21)
|
|
103
|
-
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
104
|
-
railties (8.1.2)
|
|
105
|
-
actionpack (= 8.1.2)
|
|
106
|
-
activesupport (= 8.1.2)
|
|
107
|
-
irb (~> 1.13)
|
|
108
|
-
rackup (>= 1.0.0)
|
|
109
|
-
rake (>= 12.2)
|
|
110
|
-
thor (~> 1.0, >= 1.2.2)
|
|
111
|
-
tsort (>= 0.2)
|
|
112
|
-
zeitwerk (~> 2.6)
|
|
113
|
-
rainbow (3.1.1)
|
|
114
|
-
rake (13.3.1)
|
|
115
|
-
rdoc (7.1.0)
|
|
116
|
-
erb
|
|
117
|
-
psych (>= 4.0.0)
|
|
118
|
-
tsort
|
|
119
|
-
regexp_parser (2.11.3)
|
|
120
|
-
reline (0.6.3)
|
|
121
|
-
io-console (~> 0.5)
|
|
122
|
-
rspec-core (3.13.6)
|
|
123
|
-
rspec-support (~> 3.13.0)
|
|
124
|
-
rspec-expectations (3.13.5)
|
|
125
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
126
|
-
rspec-support (~> 3.13.0)
|
|
127
|
-
rspec-mocks (3.13.7)
|
|
128
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
129
|
-
rspec-support (~> 3.13.0)
|
|
130
|
-
rspec-rails (8.0.2)
|
|
131
|
-
actionpack (>= 7.2)
|
|
132
|
-
activesupport (>= 7.2)
|
|
133
|
-
railties (>= 7.2)
|
|
134
|
-
rspec-core (~> 3.13)
|
|
135
|
-
rspec-expectations (~> 3.13)
|
|
136
|
-
rspec-mocks (~> 3.13)
|
|
137
|
-
rspec-support (~> 3.13)
|
|
138
|
-
rspec-support (3.13.6)
|
|
139
|
-
rubocop (1.82.1)
|
|
140
|
-
json (~> 2.3)
|
|
141
|
-
language_server-protocol (~> 3.17.0.2)
|
|
142
|
-
lint_roller (~> 1.1.0)
|
|
143
|
-
parallel (~> 1.10)
|
|
144
|
-
parser (>= 3.3.0.2)
|
|
145
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
146
|
-
regexp_parser (>= 2.9.3, < 3.0)
|
|
147
|
-
rubocop-ast (>= 1.48.0, < 2.0)
|
|
148
|
-
ruby-progressbar (~> 1.7)
|
|
149
|
-
unicode-display_width (>= 2.4.0, < 4.0)
|
|
150
|
-
rubocop-ast (1.49.0)
|
|
151
|
-
parser (>= 3.3.7.2)
|
|
152
|
-
prism (~> 1.7)
|
|
153
|
-
ruby-progressbar (1.13.0)
|
|
154
|
-
securerandom (0.4.1)
|
|
155
|
-
stringio (3.2.0)
|
|
156
|
-
thor (1.5.0)
|
|
157
|
-
tsort (0.2.0)
|
|
158
|
-
tzinfo (2.0.6)
|
|
159
|
-
concurrent-ruby (~> 1.0)
|
|
160
|
-
unicode-display_width (3.2.0)
|
|
161
|
-
unicode-emoji (~> 4.1)
|
|
162
|
-
unicode-emoji (4.2.0)
|
|
163
|
-
uri (1.1.1)
|
|
164
|
-
useragent (0.16.11)
|
|
165
|
-
zeitwerk (2.7.4)
|
|
166
|
-
|
|
167
|
-
PLATFORMS
|
|
168
|
-
arm64-darwin-22
|
|
169
|
-
arm64-darwin-25
|
|
170
|
-
x86_64-darwin-20
|
|
171
|
-
x86_64-linux
|
|
172
|
-
|
|
173
|
-
DEPENDENCIES
|
|
174
|
-
activesupport (>= 6.1.4.1)
|
|
175
|
-
diffy (~> 3.4)
|
|
176
|
-
rake (~> 13.2)
|
|
177
|
-
rspec-json_api!
|
|
178
|
-
rspec-rails (>= 5.0.2)
|
|
179
|
-
rubocop (~> 1.65)
|
|
180
|
-
|
|
181
|
-
BUNDLED WITH
|
|
182
|
-
4.0.4
|
data/Rakefile
DELETED
data/bin/console
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require "bundler/setup"
|
|
5
|
-
require "rspec/json_api"
|
|
6
|
-
|
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
-
|
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
11
|
-
# require "pry"
|
|
12
|
-
# Pry.start
|
|
13
|
-
|
|
14
|
-
require "irb"
|
|
15
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/gemfiles/rails_6_1.gemfile
DELETED
data/gemfiles/rails_7_1.gemfile
DELETED
data/gemfiles/rails_7_2.gemfile
DELETED
data/gemfiles/rails_8_0.gemfile
DELETED
data/gemfiles/rails_8_1.gemfile
DELETED
data/rspec-json_api.gemspec
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "lib/rspec/json_api/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "rspec-json_api"
|
|
7
|
-
spec.version = RSpec::JsonApi::VERSION
|
|
8
|
-
spec.authors = ["Michal Gajowiak"]
|
|
9
|
-
spec.email = ["m.gajowiak@nomtek.com"]
|
|
10
|
-
|
|
11
|
-
spec.summary = "RSpec extension to test JSON API response."
|
|
12
|
-
spec.homepage = "https://github.com/nomtek/rspec-json_api"
|
|
13
|
-
spec.license = "MIT"
|
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
|
|
15
|
-
|
|
16
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
-
spec.metadata["source_code_uri"] = "https://github.com/nomtek/rspec-json_api"
|
|
18
|
-
spec.metadata["changelog_uri"] = "https://github.com/nomtek/rspec-json_api/blob/master/CHANGELOG.md"
|
|
19
|
-
spec.metadata["rubygems_mfa_required"] = "true"
|
|
20
|
-
|
|
21
|
-
# Specify which files should be added to the gem when it is released.
|
|
22
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
23
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
24
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
|
25
|
-
end
|
|
26
|
-
spec.bindir = "exe"
|
|
27
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
28
|
-
spec.require_paths = ["lib"]
|
|
29
|
-
|
|
30
|
-
# Runtime dependencies. The gem only needs ActiveSupport's blank?/present?
|
|
31
|
-
# core extensions and Rails::Generators (which lives in railties); depending
|
|
32
|
-
# on the full "rails" meta-gem would force ActiveRecord, ActionCable,
|
|
33
|
-
# ActionMailer, ActionMailbox, ActiveStorage, ActionText, etc. on every
|
|
34
|
-
# consumer of a JSON-matcher gem. The >= 6.1.4.1 floor is unchanged.
|
|
35
|
-
spec.add_dependency "activesupport", ">= 6.1.4.1"
|
|
36
|
-
spec.add_dependency "diffy", ">= 3.4.2"
|
|
37
|
-
spec.add_dependency "railties", ">= 6.1.4.1"
|
|
38
|
-
spec.add_dependency "rspec-rails", ">= 5.0.2"
|
|
39
|
-
|
|
40
|
-
# For more information and examples about making a new gem, checkout our
|
|
41
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
|
42
|
-
end
|