langalex-couch_potato 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.
- data/VERSION.yml +1 -1
- data/lib/couch_potato/database.rb +2 -2
- data/spec/unit/dirty_attributes_spec.rb +6 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module CouchPotato
|
2
2
|
class Database
|
3
3
|
|
4
|
-
class ValidationsFailedError < ::
|
4
|
+
class ValidationsFailedError < ::StandardError; end
|
5
5
|
|
6
6
|
def initialize(couchrest_database)
|
7
7
|
@database = couchrest_database
|
@@ -15,7 +15,7 @@ module CouchPotato
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def save_document(document)
|
18
|
-
return unless document.dirty?
|
18
|
+
return true unless document.dirty?
|
19
19
|
if document.new?
|
20
20
|
create_document document
|
21
21
|
else
|
@@ -20,6 +20,12 @@ describe 'dirty attribute tracking' do
|
|
20
20
|
@db.save_document(plate)
|
21
21
|
end
|
22
22
|
|
23
|
+
it "should return true when not dirty" do
|
24
|
+
plate = Plate.new :food => 'sushi'
|
25
|
+
@db.save_document!(plate)
|
26
|
+
@db.save_document(plate).should be_true
|
27
|
+
end
|
28
|
+
|
23
29
|
it "should save when there are dirty attributes" do
|
24
30
|
plate = Plate.new :food => 'sushi'
|
25
31
|
@db.save_document!(plate)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: langalex-couch_potato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Lang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-05-
|
12
|
+
date: 2009-05-05 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|