safety_pin 0.0.2 → 0.0.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.
- data/lib/safety_pin/node.rb +4 -0
- data/lib/safety_pin/version.rb +1 -1
- data/spec/node_spec.rb +6 -0
- metadata +2 -2
data/lib/safety_pin/node.rb
CHANGED
@@ -122,6 +122,10 @@ module SafetyPin
|
|
122
122
|
|
123
123
|
def write_attribute(name, value)
|
124
124
|
raise PropertyError.new("Illegal operation: cannot change jcr:primaryType property") if name == "jcr:primaryType"
|
125
|
+
|
126
|
+
if value.nil? and not j_node.has_property(name)
|
127
|
+
return nil
|
128
|
+
end
|
125
129
|
|
126
130
|
name = name.to_s
|
127
131
|
|
data/lib/safety_pin/version.rb
CHANGED
data/spec/node_spec.rb
CHANGED
@@ -232,6 +232,12 @@ describe SafetyPin::Node do
|
|
232
232
|
@node.write_attribute("foo", nil)
|
233
233
|
lambda { @node["foo"] }.should raise_error(SafetyPin::NilPropertyError)
|
234
234
|
end
|
235
|
+
|
236
|
+
context "given a non-existent property and a null value" do
|
237
|
+
it "should return nil" do
|
238
|
+
@node.write_attribute("foo", nil).should be_nil
|
239
|
+
end
|
240
|
+
end
|
235
241
|
end
|
236
242
|
|
237
243
|
context "changing jcr:primaryType property" do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: safety_pin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jordan Raine
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-12 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: An easy-to-use JCR connector for JRuby
|