bigrecord 0.0.8 → 0.0.9
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/README.rdoc +5 -4
- data/VERSION +1 -1
- data/lib/big_record/abstract_base.rb +21 -14
- data/lib/big_record/base.rb +38 -30
- data/lib/big_record/br_associations.rb +100 -773
- data/lib/big_record/br_reflection.rb +1 -3
- data/lib/big_record/connection_adapters/abstract/database_statements.rb +1 -161
- data/lib/big_record/connection_adapters/abstract_adapter.rb +1 -17
- data/lib/big_record/connection_adapters/column.rb +1 -30
- data/lib/big_record/connection_adapters/hbase_adapter.rb +18 -16
- data/lib/big_record/connection_adapters/hbase_rest_adapter.rb +64 -61
- data/lib/big_record/dynamic_schema.rb +14 -0
- data/lib/big_record/embedded_associations/association_proxy.rb +0 -6
- data/lib/big_record/timestamp.rb +28 -2
- data/lib/big_record.rb +1 -4
- data/lib/bigrecord.rb +1 -1
- data/spec/connections/bigrecord.yml +2 -2
- data/spec/debug.log +215 -172
- data/spec/unit/ar_associations_spec.rb +0 -7
- data/spec/unit/{abstract_base_spec.rb → attributes_spec.rb} +20 -3
- data/spec/unit/callback_spec.rb +1 -0
- data/spec/unit/{base_spec.rb → columns_spec.rb} +2 -2
- data/spec/unit/embedded_spec.rb +1 -1
- data/spec/unit/find_spec.rb +10 -0
- data/spec/unit/model_spec.rb +13 -4
- data/spec/unit/scanner_spec.rb +44 -0
- data/tasks/gem.rb +0 -1
- data/tasks/rdoc.rb +1 -1
- metadata +6 -14
@@ -1,10 +1,10 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'attributes_spec'))
|
3
3
|
|
4
4
|
describe BigRecord::Base do
|
5
5
|
it_should_behave_like "BigRecord::AbstractBase"
|
6
6
|
|
7
|
-
describe '
|
7
|
+
describe 'column functionality' do
|
8
8
|
|
9
9
|
before(:all) do
|
10
10
|
# Grab the columns from a simple BigRecord model
|
data/spec/unit/embedded_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'attributes_spec'))
|
3
3
|
|
4
4
|
describe BigRecord::Embedded do
|
5
5
|
|
data/spec/unit/find_spec.rb
CHANGED
@@ -29,6 +29,16 @@ describe BigRecord::Base do
|
|
29
29
|
Zoo.find(id).should == [zoo]
|
30
30
|
end
|
31
31
|
|
32
|
+
it "should be invoked when #all and #first are called" do
|
33
|
+
zoo = Zoo.new
|
34
|
+
|
35
|
+
Zoo.should_receive(:find).with(:all).and_return([zoo])
|
36
|
+
Zoo.all.should == [zoo]
|
37
|
+
|
38
|
+
Zoo.should_receive(:find).with(:first).and_return(zoo)
|
39
|
+
Zoo.first.should == zoo
|
40
|
+
end
|
41
|
+
|
32
42
|
end
|
33
43
|
|
34
44
|
end
|
data/spec/unit/model_spec.rb
CHANGED
@@ -76,11 +76,11 @@ describe BigRecord::Base do
|
|
76
76
|
Book.new.should respond_to(:save!)
|
77
77
|
end
|
78
78
|
|
79
|
-
describe '
|
79
|
+
describe 'save and delete functionality' do
|
80
80
|
|
81
81
|
describe 'with a new resource' do
|
82
82
|
|
83
|
-
it 'should create new entries in the data store' do
|
83
|
+
it 'should create new entries in the data store and delete them' do
|
84
84
|
# Create a new object
|
85
85
|
book = Book.new( :title => "I Am Legend",
|
86
86
|
:author => "Richard Matheson",
|
@@ -99,6 +99,15 @@ describe BigRecord::Base do
|
|
99
99
|
book2.title.should == "I Am Legend"
|
100
100
|
book2.author.should == "Richard Matheson"
|
101
101
|
book2.description.should == "The most clever and riveting vampire novel since Dracula."
|
102
|
+
|
103
|
+
# Verify that we can destroy this
|
104
|
+
lambda {
|
105
|
+
book2.destroy
|
106
|
+
}.should_not raise_error
|
107
|
+
|
108
|
+
lambda {
|
109
|
+
verify_delete = Book.find(book.id)
|
110
|
+
}.should raise_error
|
102
111
|
end
|
103
112
|
|
104
113
|
it 'should raise an exception with .save! if a record was not saved or true if successful' do
|
@@ -188,7 +197,7 @@ describe BigRecord::Base do
|
|
188
197
|
|
189
198
|
end
|
190
199
|
|
191
|
-
describe 'attribute functionality' do
|
200
|
+
describe 'attribute functionality on records' do
|
192
201
|
|
193
202
|
it "should return a list of attribute names with .attribute_names" do
|
194
203
|
(Book.new.attribute_names & ["attribute:author", "attribute:description", "attribute:links", "attribute:title"]).should == ["attribute:author", "attribute:description", "attribute:links", "attribute:title"]
|
@@ -250,7 +259,7 @@ describe BigRecord::Base do
|
|
250
259
|
book.save.should be_true
|
251
260
|
|
252
261
|
book.update_attribute(:description, "One of the Ten All-Time Best Novels of Vampirism.")
|
253
|
-
|
262
|
+
book.reload
|
254
263
|
book.description.should == "One of the Ten All-Time Best Novels of Vampirism."
|
255
264
|
end
|
256
265
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
|
+
|
3
|
+
describe BigRecord::Base do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
Book.delete_all
|
7
|
+
@titles = ["I Am Legend", "The Beach", "Neuromancer"]
|
8
|
+
id1 = Book.create(:title => @titles[0], :author => "Richard Matheson").id
|
9
|
+
id2 = Book.create(:title => @titles[1], :author => "Alex Garland").id
|
10
|
+
id3 = Book.create(:title => @titles[2], :author => "William Gibson").id
|
11
|
+
@ids = [id1, id2, id3]
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:all) do
|
15
|
+
Book.delete_all
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "scanner functionality" do
|
19
|
+
|
20
|
+
it "should retrieve all records with find" do
|
21
|
+
books = Book.find(:all)
|
22
|
+
books.size.should == 3
|
23
|
+
|
24
|
+
@titles.each do |title|
|
25
|
+
books.map(&:title).should include(title)
|
26
|
+
end
|
27
|
+
|
28
|
+
@ids.each do |id|
|
29
|
+
books.map(&:id).should include(id)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should retrieve all record with scan" do
|
34
|
+
count = 0
|
35
|
+
Book.scan do |book|
|
36
|
+
count += 1
|
37
|
+
@titles.include?(book.title).should be_true
|
38
|
+
end
|
39
|
+
count.should == 3
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
data/tasks/gem.rb
CHANGED
data/tasks/rdoc.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigrecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- openplaces.org
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,16 +32,6 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.0.0
|
34
34
|
version:
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: bigrecord-driver
|
37
|
-
type: :runtime
|
38
|
-
version_requirement:
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: "0"
|
44
|
-
version:
|
45
35
|
- !ruby/object:Gem::Dependency
|
46
36
|
name: activesupport
|
47
37
|
type: :runtime
|
@@ -161,18 +151,20 @@ files:
|
|
161
151
|
- spec/lib/zoo.rb
|
162
152
|
- spec/spec.opts
|
163
153
|
- spec/spec_helper.rb
|
164
|
-
- spec/unit/abstract_base_spec.rb
|
165
154
|
- spec/unit/adapters/abstract_adapter_spec.rb
|
166
155
|
- spec/unit/adapters/adapter_shared_spec.rb
|
167
156
|
- spec/unit/adapters/hbase_adapter_spec.rb
|
168
157
|
- spec/unit/ar_associations_spec.rb
|
169
|
-
- spec/unit/
|
158
|
+
- spec/unit/attributes_spec.rb
|
170
159
|
- spec/unit/br_associations_spec.rb
|
160
|
+
- spec/unit/callback_spec.rb
|
161
|
+
- spec/unit/columns_spec.rb
|
171
162
|
- spec/unit/embedded_spec.rb
|
172
163
|
- spec/unit/find_spec.rb
|
173
164
|
- spec/unit/hash_helper_spec.rb
|
174
165
|
- spec/unit/migration_spec.rb
|
175
166
|
- spec/unit/model_spec.rb
|
167
|
+
- spec/unit/scanner_spec.rb
|
176
168
|
- spec/unit/validations_spec.rb
|
177
169
|
- tasks/bigrecord_tasks.rake
|
178
170
|
- tasks/data_store.rb
|