neo4j-rspec 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c07494702e7a337029d2e268c8d1b2d909d56a3e
4
- data.tar.gz: 82fef422106a2c7debb6bdf45297b54354016ce1
3
+ metadata.gz: 25df2cc0200079ea1f6e147aa0a670ae5018cc99
4
+ data.tar.gz: 6d907ffab830735168f46ab0bedb5b842b406a7e
5
5
  SHA512:
6
- metadata.gz: b5a523760325d6bd1eb2f1f82977f03ac7ad466906836dc39b364782231b3ae64da9b76ac13056dccb493163571a270a88604c0c43e1a4c6a51fa5558131d67b
7
- data.tar.gz: 299ce90f0eb799ab8ce27a093339658e10dcf0603a98ce087499e89d6d758c73f0574aa57914ba99572f72bd45cece894168d8f7e39fd7a8f1913d8d2cc535ca
6
+ metadata.gz: b00878799066b8da4fd80dda0ddd14751aa91d9859da8f7a32f35b4f37bc7cfb55a890babba6fa41450f4b62a53cb0ee0428fb7415651665ad8dff0e1cb125c6
7
+ data.tar.gz: cebefbf4404b09ed6a6783053eb5865304b60d2392c03fc2d16bf0b77886bfa4222730fa23177eb691f0f1fbc31e50b4865a671a00768afef076a8ae98d170ef
data/README.md CHANGED
@@ -52,6 +52,12 @@ gem install neo4j-rspec
52
52
 
53
53
  it { is_expected.to have_relationship_type("WROTE") }
54
54
 
55
+ - Create Unique
56
+
57
+ it { is_expected.to use_create_unique }
58
+ it { is_expected.to use_create_unique(:all) }
59
+ it { is_expected.to use_create_unique(on: [:key1, :key2]) }
60
+
55
61
 
56
62
  ## Need yet another matcher?
57
63
 
@@ -10,11 +10,11 @@ module Neo4j
10
10
  end
11
11
 
12
12
  failure_message do |rel|
13
- "expected the #{rel.class.name} relation to come from #{model_sym}"
13
+ "#{failure_start(rel)} to come from #{model_sym}"
14
14
  end
15
15
 
16
16
  failure_message_when_negated do |rel|
17
- "expected the #{rel.class.name} relation not to come from #{model_sym}"
17
+ "#{failure_start(rel)} not to come from #{model_sym}"
18
18
  end
19
19
  end
20
20
 
@@ -24,11 +24,11 @@ module Neo4j
24
24
  end
25
25
 
26
26
  failure_message do |rel|
27
- "expected the #{rel.class.name} relation to lead to #{model_sym}"
27
+ "#{failure_start(rel)} to lead to #{model_sym}"
28
28
  end
29
29
 
30
30
  failure_message_when_negated do |rel|
31
- "expected the #{rel.class.name} relation not to lead to #{model_sym}"
31
+ "#{failure_start(rel)} not to lead to #{model_sym}"
32
32
  end
33
33
  end
34
34
 
@@ -38,11 +38,45 @@ module Neo4j
38
38
  end
39
39
 
40
40
  failure_message do |rel|
41
- "expected the #{rel.class.name} relation to have a relationship type #{type}"
41
+ "#{failure_start(rel)} to have a relationship type #{type}"
42
42
  end
43
43
 
44
44
  failure_message_when_negated do |rel|
45
- "expected the #{rel.class.name} relation not to have a relationship type #{type}"
45
+ "#{failure_start(rel)} not to have a relationship type #{type}"
46
+ end
47
+ end
48
+
49
+ matcher :use_create_unique do |arg|
50
+ match do |rel|
51
+ rel.class.unique? && (arg.nil? || arg == rel.class.creates_unique_option)
52
+ end
53
+
54
+ description do
55
+ msg = "use CREATE UNIQUE"
56
+ msg += " with option #{arg}" if arg
57
+ msg
58
+ end
59
+
60
+ failure_message do |rel|
61
+ msg = "#{failure_start(rel)} to use CREATE UNIQUE clause"
62
+ if arg
63
+ actual = rel.class.creates_unique_option
64
+ msg += "\n expected option: #{arg}\n actual option: #{actual}"
65
+ end
66
+ msg
67
+ end
68
+
69
+ failure_message_when_negated do |rel|
70
+ msg = "#{failure_start(rel)} not to use CREATE UNIQUE clause"
71
+ if arg
72
+ actual = rel.class.creates_unique_option
73
+ msg += "\n expected option: #{arg}\n actual option: #{actual}"
74
+ end
75
+ msg
76
+ end
77
+
78
+ def failure_start(rel)
79
+ "expected the #{rel.class.name} relation"
46
80
  end
47
81
  end
48
82
  end
@@ -1,5 +1,5 @@
1
1
  module Neo4j
2
2
  module RSpec
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
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.1
4
+ version: 0.2.2
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-03-21 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: neo4j