neo4j-rspec 0.2.2 → 0.2.3
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/README.md +8 -0
- data/lib/neo4j/rspec/matchers/has_n.rb +1 -1
- data/lib/neo4j/rspec/matchers/properties.rb +15 -12
- data/lib/neo4j/rspec/version.rb +1 -1
- data/neo4j-rspec.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 933b93a35b254e73872753e5ef6cdb9104cd5488
|
4
|
+
data.tar.gz: 69ffc3297f2a4f79a693c504d19bd71eb1cf9ba9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a43c59c457eac06e4f03cd72a0954e97f1e269838555a2a760bdc50a900170be97c276ac33381cd6b7937b92c64f99a8866be70c83500f36b52611c4ca1084b
|
7
|
+
data.tar.gz: 42689d8cfe8a976bbde57788916584fe47dcf3e96cb1808e40b87c13acffb5c28ab94d18242de26872f0544bc26eb79eb9a39981e3460b1af53c1cf22e72037f
|
data/README.md
CHANGED
@@ -14,6 +14,14 @@ or install it directly
|
|
14
14
|
gem install neo4j-rspec
|
15
15
|
```
|
16
16
|
|
17
|
+
Then configure it in your `spec_helper` (or `rails_helper`):
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.include Neo4j::RSpec::Matchers
|
22
|
+
# ... other configuration ...
|
23
|
+
end
|
24
|
+
```
|
17
25
|
|
18
26
|
## Examples
|
19
27
|
|
@@ -128,7 +128,7 @@ module Neo4j
|
|
128
128
|
|
129
129
|
description do |model|
|
130
130
|
with_messages = matchers.map(&:description).join(" ")
|
131
|
-
macro.description(
|
131
|
+
macro.description(association_name) + " " + with_messages
|
132
132
|
end
|
133
133
|
|
134
134
|
failure_message do |model|
|
@@ -8,28 +8,30 @@ module Neo4j
|
|
8
8
|
|
9
9
|
matcher :track_creations do
|
10
10
|
match do |model|
|
11
|
-
|
11
|
+
klass = model.class
|
12
|
+
klass.attributes[:created_at] && klass.attributes[:created_at][:type] == DateTime
|
12
13
|
end
|
13
14
|
|
14
15
|
failure_message do |model|
|
15
|
-
"expected the #{model.name} model to track creations (`created_at`)"
|
16
|
+
"expected the #{model.class.name} model to track creations (`created_at`)"
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
20
|
matcher :track_modifications do
|
20
21
|
match do |model|
|
21
|
-
|
22
|
+
klass = model.class
|
23
|
+
klass.attributes[:updated_at] && klass.attributes[:updated_at][:type] == DateTime
|
22
24
|
end
|
23
25
|
|
24
26
|
failure_message do |model|
|
25
|
-
"expected the #{model.name} model to track modifications (`updated_at`)"
|
27
|
+
"expected the #{model.class.name} model to track modifications (`updated_at`)"
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
31
|
matcher :define_property do |name, type = nil|
|
30
32
|
match do |model|
|
31
33
|
name = name.to_s
|
32
|
-
return false unless model.attributes.key?(name)
|
34
|
+
return false unless model.class.attributes.key?(name)
|
33
35
|
|
34
36
|
if type
|
35
37
|
nesting = Neo4j::RSpec::Compat.current.property_nesting
|
@@ -40,11 +42,11 @@ module Neo4j
|
|
40
42
|
end
|
41
43
|
|
42
44
|
failure_message do |model|
|
43
|
-
"expected the #{model.name} model to have a `#{type}` property #{name}"
|
45
|
+
"expected the #{model.class.name} model to have a `#{type}` property #{name}"
|
44
46
|
end
|
45
47
|
|
46
48
|
failure_message_when_negated do |model|
|
47
|
-
"expected the #{model.name} model not to have a `#{type}` property #{name}"
|
49
|
+
"expected the #{model.class.name} model not to have a `#{type}` property #{name}"
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
@@ -53,16 +55,17 @@ module Neo4j
|
|
53
55
|
fail ArgumentError, 'constraint type should be given' if type.blank?
|
54
56
|
|
55
57
|
match do |model|
|
56
|
-
model.
|
57
|
-
|
58
|
+
klass = model.class
|
59
|
+
klass.attributes.key?(name.to_s) &&
|
60
|
+
Neo4j::RSpec::Compat.current.property_constraint?(klass.attributes[name.to_s], type)
|
58
61
|
end
|
59
62
|
|
60
63
|
failure_message do |model|
|
61
|
-
"expected the #{model.name} model to have a #{type} constraint on #{name}"
|
64
|
+
"expected the #{model.class.name} model to have a #{type} constraint on #{name}"
|
62
65
|
end
|
63
66
|
|
64
67
|
failure_message_when_negated do |model|
|
65
|
-
"expected the #{model.name} model not to have a #{type} constraint on #{name}"
|
68
|
+
"expected the #{model.class.name} model not to have a #{type} constraint on #{name}"
|
66
69
|
end
|
67
70
|
end
|
68
71
|
|
@@ -70,7 +73,7 @@ module Neo4j
|
|
70
73
|
fail ArgumentError, 'index name should be given' if name.blank?
|
71
74
|
|
72
75
|
match do |model|
|
73
|
-
model.attributes.key?(name.to_s) &&
|
76
|
+
model.class.attributes.key?(name.to_s) &&
|
74
77
|
model.declared_properties[name.to_s].index?
|
75
78
|
end
|
76
79
|
|
data/lib/neo4j/rspec/version.rb
CHANGED
data/neo4j-rspec.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Tataurov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: neo4j
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
33
|
+
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
40
|
+
version: '3.0'
|
41
41
|
description: RSpec matchers for Neo4j.rb
|
42
42
|
email:
|
43
43
|
- sineedus@mail.ru
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.4.6
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: RSpec matchers for Neo4j.rb
|