jsonapi-resources-matchers 0.5.0 → 0.6.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03cf6ea8943f6a9191928662b6566341b283d0e1
|
4
|
+
data.tar.gz: 9e8246871c0fd14664e1b61eccd935f7b73fc31b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d29699e3bd8c0591c11a45255a42b369f7a037159438eb7f564b6829f8bf8e803a8aa9dca0ce8e808d74ec75fa174499a76754adaa18af65d264d7bf5fb07773
|
7
|
+
data.tar.gz: 6041e23d4a5442b4a2d90e0940806fd3e26269137ca95736ae11f162074c5f389c48e8ac070ee004c7c3fd60cc8f4032e6f3edf842acad8ac58e7391c3aa8c82
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [0.6.0] - 2016-12-22
|
6
|
+
### Added
|
7
|
+
- support for `have_sortable_field`
|
8
|
+
|
5
9
|
## [0.5.0] - 2016-11-24
|
6
10
|
### Added
|
7
11
|
- support for `have_creatable_field` and `have_updatable_field`
|
@@ -2,6 +2,7 @@ require "jsonapi/resources/matchers/version"
|
|
2
2
|
require "jsonapi/resources/matchers/have_attribute"
|
3
3
|
require "jsonapi/resources/matchers/have_creatable_field"
|
4
4
|
require "jsonapi/resources/matchers/have_updatable_field"
|
5
|
+
require "jsonapi/resources/matchers/have_sortable_field"
|
5
6
|
require "jsonapi/resources/matchers/filter"
|
6
7
|
require "jsonapi/resources/matchers/relationship"
|
7
8
|
require "jsonapi/resources/matchers/have_model_name"
|
@@ -19,6 +20,10 @@ module JSONAPI
|
|
19
20
|
HaveUpdatableField.new(name)
|
20
21
|
end
|
21
22
|
|
23
|
+
def have_sortable_field(name)
|
24
|
+
HaveSortableField.new(name)
|
25
|
+
end
|
26
|
+
|
22
27
|
def have_attribute(name)
|
23
28
|
HaveAttribute.new(name)
|
24
29
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module JSONAPI
|
2
|
+
module Resources
|
3
|
+
module Matchers
|
4
|
+
class HaveSortableField
|
5
|
+
|
6
|
+
attr_accessor :name, :resource
|
7
|
+
|
8
|
+
def initialize(name)
|
9
|
+
self.name = name
|
10
|
+
end
|
11
|
+
|
12
|
+
def matches?(resource)
|
13
|
+
self.resource = resource
|
14
|
+
resource.class.sortable_fields(resource.context).include?(name)
|
15
|
+
end
|
16
|
+
|
17
|
+
def failure_message
|
18
|
+
resource_name = resource.class.name.demodulize
|
19
|
+
%Q(expected #{resource_name} to have sortable field `#{name}`)
|
20
|
+
end
|
21
|
+
|
22
|
+
def failure_message_when_negated
|
23
|
+
resource_name = resource.class.name.demodulize
|
24
|
+
%Q(expected #{resource_name} not to have sortable field `#{name}`)
|
25
|
+
end
|
26
|
+
|
27
|
+
def description
|
28
|
+
"have sortable field `#{name}`"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
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.
|
4
|
+
version: 0.6.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: 2016-
|
12
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jsonapi-resources
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/jsonapi/resources/matchers/have_creatable_field.rb
|
109
109
|
- lib/jsonapi/resources/matchers/have_model_name.rb
|
110
110
|
- lib/jsonapi/resources/matchers/have_primary_key.rb
|
111
|
+
- lib/jsonapi/resources/matchers/have_sortable_field.rb
|
111
112
|
- lib/jsonapi/resources/matchers/have_updatable_field.rb
|
112
113
|
- lib/jsonapi/resources/matchers/integrations/rspec.rb
|
113
114
|
- lib/jsonapi/resources/matchers/relationship.rb
|