thefool808-couch_potato 0.2.7
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/MIT-LICENSE.txt +19 -0
- data/README.md +269 -0
- data/VERSION.yml +4 -0
- data/init.rb +3 -0
- data/lib/core_ext/date.rb +10 -0
- data/lib/core_ext/object.rb +5 -0
- data/lib/core_ext/string.rb +15 -0
- data/lib/core_ext/time.rb +11 -0
- data/lib/couch_potato.rb +41 -0
- data/lib/couch_potato/database.rb +96 -0
- data/lib/couch_potato/persistence.rb +94 -0
- data/lib/couch_potato/persistence/belongs_to_property.rb +58 -0
- data/lib/couch_potato/persistence/callbacks.rb +96 -0
- data/lib/couch_potato/persistence/dirty_attributes.rb +27 -0
- data/lib/couch_potato/persistence/json.rb +45 -0
- data/lib/couch_potato/persistence/magic_timestamps.rb +13 -0
- data/lib/couch_potato/persistence/properties.rb +56 -0
- data/lib/couch_potato/persistence/simple_property.rb +77 -0
- data/lib/couch_potato/view/base_view_spec.rb +24 -0
- data/lib/couch_potato/view/custom_view_spec.rb +27 -0
- data/lib/couch_potato/view/custom_views.rb +44 -0
- data/lib/couch_potato/view/model_view_spec.rb +63 -0
- data/lib/couch_potato/view/properties_view_spec.rb +39 -0
- data/lib/couch_potato/view/raw_view_spec.rb +25 -0
- data/lib/couch_potato/view/view_query.rb +44 -0
- data/rails/init.rb +7 -0
- data/spec/callbacks_spec.rb +271 -0
- data/spec/create_spec.rb +22 -0
- data/spec/custom_view_spec.rb +134 -0
- data/spec/destroy_spec.rb +29 -0
- data/spec/property_spec.rb +64 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/unit/attributes_spec.rb +26 -0
- data/spec/unit/create_spec.rb +58 -0
- data/spec/unit/customs_views_spec.rb +15 -0
- data/spec/unit/database_spec.rb +18 -0
- data/spec/unit/dirty_attributes_spec.rb +113 -0
- data/spec/unit/string_spec.rb +13 -0
- data/spec/unit/view_query_spec.rb +9 -0
- data/spec/update_spec.rb +40 -0
- metadata +135 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe String, 'camelize' do
|
|
4
|
+
it "should camelize a string" do
|
|
5
|
+
'my_string'.camelize.should == 'MyString'
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe String, 'underscore' do
|
|
10
|
+
it "should underscore a string" do
|
|
11
|
+
'MyString'.underscore.should == 'my_string'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CouchPotato::View::ViewQuery, 'query_view' do
|
|
4
|
+
it "should not pass a key if conditions are empty" do
|
|
5
|
+
db = mock 'db'
|
|
6
|
+
db.should_receive(:view).with(anything, {})
|
|
7
|
+
CouchPotato::View::ViewQuery.new(db, '', '', '', '').query_view!
|
|
8
|
+
end
|
|
9
|
+
end
|
data/spec/update_spec.rb
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "create" do
|
|
4
|
+
before(:all) do
|
|
5
|
+
recreate_db
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
before(:each) do
|
|
9
|
+
@comment = Comment.new :title => 'my_title'
|
|
10
|
+
CouchPotato.database.save_document! @comment
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should update the revision" do
|
|
14
|
+
old_rev = @comment._rev
|
|
15
|
+
@comment.title = 'xyz'
|
|
16
|
+
CouchPotato.database.save_document! @comment
|
|
17
|
+
@comment._rev.should_not == old_rev
|
|
18
|
+
@comment._rev.should_not be_nil
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should not update created at" do
|
|
22
|
+
old_created_at = @comment.created_at
|
|
23
|
+
@comment.title = 'xyz'
|
|
24
|
+
CouchPotato.database.save_document! @comment
|
|
25
|
+
@comment.created_at.should == old_created_at
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should update updated at" do
|
|
29
|
+
old_updated_at = @comment.updated_at
|
|
30
|
+
@comment.title = 'xyz'
|
|
31
|
+
CouchPotato.database.save_document! @comment
|
|
32
|
+
@comment.updated_at.should > old_updated_at
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "should update the attributes" do
|
|
36
|
+
@comment.title = 'new title'
|
|
37
|
+
CouchPotato.database.save_document! @comment
|
|
38
|
+
CouchPotato.couchrest_database.get("#{@comment.id}")['title'].should == 'new title'
|
|
39
|
+
end
|
|
40
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: thefool808-couch_potato
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.7
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Alexander Lang
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-05-21 00:00:00 -07:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: json
|
|
17
|
+
type: :runtime
|
|
18
|
+
version_requirement:
|
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
20
|
+
requirements:
|
|
21
|
+
- - ">="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: "0"
|
|
24
|
+
version:
|
|
25
|
+
- !ruby/object:Gem::Dependency
|
|
26
|
+
name: validatable
|
|
27
|
+
type: :runtime
|
|
28
|
+
version_requirement:
|
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: "0"
|
|
34
|
+
version:
|
|
35
|
+
- !ruby/object:Gem::Dependency
|
|
36
|
+
name: couchrest
|
|
37
|
+
type: :runtime
|
|
38
|
+
version_requirement:
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: "0.24"
|
|
44
|
+
version:
|
|
45
|
+
description: Ruby persistence layer for CouchDB
|
|
46
|
+
email: alex@upstream-berlin.com
|
|
47
|
+
executables: []
|
|
48
|
+
|
|
49
|
+
extensions: []
|
|
50
|
+
|
|
51
|
+
extra_rdoc_files:
|
|
52
|
+
- README.md
|
|
53
|
+
files:
|
|
54
|
+
- MIT-LICENSE.txt
|
|
55
|
+
- README.md
|
|
56
|
+
- VERSION.yml
|
|
57
|
+
- init.rb
|
|
58
|
+
- lib/core_ext/date.rb
|
|
59
|
+
- lib/core_ext/object.rb
|
|
60
|
+
- lib/core_ext/string.rb
|
|
61
|
+
- lib/core_ext/time.rb
|
|
62
|
+
- lib/couch_potato.rb
|
|
63
|
+
- lib/couch_potato/database.rb
|
|
64
|
+
- lib/couch_potato/persistence.rb
|
|
65
|
+
- lib/couch_potato/persistence/belongs_to_property.rb
|
|
66
|
+
- lib/couch_potato/persistence/callbacks.rb
|
|
67
|
+
- lib/couch_potato/persistence/dirty_attributes.rb
|
|
68
|
+
- lib/couch_potato/persistence/json.rb
|
|
69
|
+
- lib/couch_potato/persistence/magic_timestamps.rb
|
|
70
|
+
- lib/couch_potato/persistence/properties.rb
|
|
71
|
+
- lib/couch_potato/persistence/simple_property.rb
|
|
72
|
+
- lib/couch_potato/view/base_view_spec.rb
|
|
73
|
+
- lib/couch_potato/view/custom_view_spec.rb
|
|
74
|
+
- lib/couch_potato/view/custom_views.rb
|
|
75
|
+
- lib/couch_potato/view/model_view_spec.rb
|
|
76
|
+
- lib/couch_potato/view/properties_view_spec.rb
|
|
77
|
+
- lib/couch_potato/view/raw_view_spec.rb
|
|
78
|
+
- lib/couch_potato/view/view_query.rb
|
|
79
|
+
- rails/init.rb
|
|
80
|
+
- spec/callbacks_spec.rb
|
|
81
|
+
- spec/create_spec.rb
|
|
82
|
+
- spec/custom_view_spec.rb
|
|
83
|
+
- spec/destroy_spec.rb
|
|
84
|
+
- spec/property_spec.rb
|
|
85
|
+
- spec/spec.opts
|
|
86
|
+
- spec/spec_helper.rb
|
|
87
|
+
- spec/unit/attributes_spec.rb
|
|
88
|
+
- spec/unit/create_spec.rb
|
|
89
|
+
- spec/unit/customs_views_spec.rb
|
|
90
|
+
- spec/unit/database_spec.rb
|
|
91
|
+
- spec/unit/dirty_attributes_spec.rb
|
|
92
|
+
- spec/unit/string_spec.rb
|
|
93
|
+
- spec/unit/view_query_spec.rb
|
|
94
|
+
- spec/update_spec.rb
|
|
95
|
+
has_rdoc: true
|
|
96
|
+
homepage: http://github.com/langalex/couch_potato
|
|
97
|
+
post_install_message:
|
|
98
|
+
rdoc_options:
|
|
99
|
+
- --charset=UTF-8
|
|
100
|
+
require_paths:
|
|
101
|
+
- lib
|
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: "0"
|
|
107
|
+
version:
|
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
|
+
requirements:
|
|
110
|
+
- - ">="
|
|
111
|
+
- !ruby/object:Gem::Version
|
|
112
|
+
version: "0"
|
|
113
|
+
version:
|
|
114
|
+
requirements: []
|
|
115
|
+
|
|
116
|
+
rubyforge_project:
|
|
117
|
+
rubygems_version: 1.2.0
|
|
118
|
+
signing_key:
|
|
119
|
+
specification_version: 2
|
|
120
|
+
summary: Ruby persistence layer for CouchDB
|
|
121
|
+
test_files:
|
|
122
|
+
- spec/callbacks_spec.rb
|
|
123
|
+
- spec/create_spec.rb
|
|
124
|
+
- spec/custom_view_spec.rb
|
|
125
|
+
- spec/destroy_spec.rb
|
|
126
|
+
- spec/property_spec.rb
|
|
127
|
+
- spec/spec_helper.rb
|
|
128
|
+
- spec/unit/attributes_spec.rb
|
|
129
|
+
- spec/unit/create_spec.rb
|
|
130
|
+
- spec/unit/customs_views_spec.rb
|
|
131
|
+
- spec/unit/database_spec.rb
|
|
132
|
+
- spec/unit/dirty_attributes_spec.rb
|
|
133
|
+
- spec/unit/string_spec.rb
|
|
134
|
+
- spec/unit/view_query_spec.rb
|
|
135
|
+
- spec/update_spec.rb
|