safety_pin 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module SafetyPin
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-11 00:00:00 Z
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