orm_adapter-nobrainer 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +44 -0
- data/Rakefile +1 -0
- data/lib/orm_adapter-nobrainer.rb +3 -0
- data/lib/orm_adapter-nobrainer/nobrainer.rb +75 -0
- data/lib/orm_adapter-nobrainer/version.rb +3 -0
- data/orm_adapter-nobrainer.gemspec +29 -0
- data/spec/example_app_shared.rb +242 -0
- data/spec/models.rb +12 -0
- data/spec/no_brainer_spec.rb +20 -0
- data/spec/spec_helper.rb +6 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 892a6a4f6de55d2c43f6ac0ef383cbc385657029
|
4
|
+
data.tar.gz: cba3bbe77b3678f1a93e4a88ce42f636f0042bd0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 81857aef2d003e96892806fb86c1e7e514e289c47e2172e1fa2b17e2ad1712732a263fa8a5e5d40632bce1514e7b231b81b6ac04202c6df42165d11f1941fe1d
|
7
|
+
data.tar.gz: adf74a48305f7d7d2a341d6437bd0fa64daa2a90b82b5b708571427d70817205334251c416f49cf0da7e92e0b25e36138327b68ef99140f4e1894500a8269493
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Colin Mattson
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# orm_adapter-nobrainer
|
2
|
+
|
3
|
+
orm_adapter-nobrainer is an [OrmAdapter][orma] plugin that adds support for
|
4
|
+
Nicolas Viennot's [NoBrainer][nborm] RethinkDB ORM.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'orm_adapter-nobrainer'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install orm_adapter-nobrainer
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Include it in your Gemfile.
|
25
|
+
|
26
|
+
## Caveats
|
27
|
+
|
28
|
+
**N.B.:** Not all orm_adapter tests pass! Due to eccentricities in the way
|
29
|
+
NoBrainer handles associations, orm_adapter-nobrainer currently fails (as
|
30
|
+
expected) when attempting to write to a has-many association.
|
31
|
+
|
32
|
+
This will *likely* not affect real-world use, but is on the roadmap to be
|
33
|
+
addressed.
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it ( https://github.com/[my-github-username]/orm_adapter-nobrainer/fork )
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create a new Pull Request
|
42
|
+
|
43
|
+
[orma]: https://github.com/ianwhite/orm_adapter
|
44
|
+
[nborm]: https://github.com/nviennot/nobrainer/
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'nobrainer'
|
2
|
+
|
3
|
+
module NoBrainer
|
4
|
+
module Document
|
5
|
+
module ClassMethods
|
6
|
+
include OrmAdapter::ToAdapter
|
7
|
+
end
|
8
|
+
|
9
|
+
class OrmAdapter < ::OrmAdapter::Base
|
10
|
+
# Get a list of column/property/field names
|
11
|
+
def column_names
|
12
|
+
klass.fields.keys
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get an instance by id of the model. Raises an error if a model is not found.
|
16
|
+
def get!(id)
|
17
|
+
klass.find!(wrap_key(id))
|
18
|
+
end
|
19
|
+
|
20
|
+
# Get an instance by id of the model. Returns nil if a model is not found.
|
21
|
+
def get(id)
|
22
|
+
klass.find(wrap_key(id))
|
23
|
+
end
|
24
|
+
|
25
|
+
# Find the first instance, optionally matching conditions, and specifying order
|
26
|
+
#
|
27
|
+
# You can call with just conditions, providing a hash
|
28
|
+
#
|
29
|
+
# User.to_adapter.find_first :name => "Fred", :age => 23
|
30
|
+
#
|
31
|
+
# Or you can specify :order, and :conditions as keys
|
32
|
+
#
|
33
|
+
# User.to_adapter.find_first :conditions => {:name => "Fred", :age => 23}
|
34
|
+
# User.to_adapter.find_first :order => [:age, :desc]
|
35
|
+
# User.to_adapter.find_first :order => :name, :conditions => {:age => 18}
|
36
|
+
#
|
37
|
+
# When specifying :order, it may be
|
38
|
+
# * a single arg e.g. <tt>:order => :name</tt>
|
39
|
+
# * a single pair with :asc, or :desc as last, e.g. <tt>:order => [:name, :desc]</tt>
|
40
|
+
# * an array of single args or pairs (with :asc or :desc as last), e.g. <tt>:order => [[:name, :asc], [:age, :desc]]</tt>
|
41
|
+
#
|
42
|
+
def find_first(options = {})
|
43
|
+
conditions, order = extract_conditions!(options)
|
44
|
+
klass.where(conditions).order_by(order_to_nql(order)).first
|
45
|
+
end
|
46
|
+
|
47
|
+
# Find all models, optionally matching conditions, and specifying order
|
48
|
+
# @see OrmAdapter::Base#find_first for how to specify order and conditions
|
49
|
+
def find_all(options = {})
|
50
|
+
conditions, order, limit, offset = extract_conditions!(options)
|
51
|
+
klass.where(conditions).order_by(order_to_nql(order)).limit(limit).skip(offset)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Create a model using attributes
|
55
|
+
def create!(attributes = {})
|
56
|
+
klass.create!(attributes)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Destroy an instance by passing in the instance itself.
|
60
|
+
def destroy(object)
|
61
|
+
object.destroy if valid_object?(object)
|
62
|
+
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
# NoBrainer does not accept arrays as an `order_by` argument.
|
66
|
+
def order_to_nql(order)
|
67
|
+
if order.empty?
|
68
|
+
nil
|
69
|
+
else
|
70
|
+
order.to_h
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'orm_adapter-nobrainer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'orm_adapter-nobrainer'
|
8
|
+
spec.version = OrmAdapterNoBrainer::VERSION
|
9
|
+
spec.summary = %q{NoBrainer support for orm_adapter}
|
10
|
+
# spec.description = %q{TODO: Write a longer description. Optional.}
|
11
|
+
spec.homepage = 'https://github.com/cmattson/orm_adapter-nobrainer'
|
12
|
+
spec.license = 'MIT'
|
13
|
+
spec.authors = ['Colin Mattson']
|
14
|
+
spec.email = ['colinmattson@gmail.com']
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.0.0'
|
24
|
+
spec.add_development_dependency 'yard', '>= 0.6.0'
|
25
|
+
spec.add_development_dependency 'rethinkdb', '~> 1.13'
|
26
|
+
|
27
|
+
spec.add_dependency 'orm_adapter', '~> 0.5.0'
|
28
|
+
spec.add_dependency 'nobrainer', '~> 0.15.0'
|
29
|
+
end
|
@@ -0,0 +1,242 @@
|
|
1
|
+
# Copied from orm_adapter and fixed some Specs
|
2
|
+
|
3
|
+
# to test your new orm_adapter, make an example app that matches the functionality
|
4
|
+
# found in the existing specs for example, look at spec/orm_adapter/adapters/active_record_spec.rb
|
5
|
+
#
|
6
|
+
# Then you can execute this shared spec as follows:
|
7
|
+
#
|
8
|
+
# it_should_behave_like "example app with orm_adapter" do
|
9
|
+
# let(:user_class) { User }
|
10
|
+
# let(:note_class) { Note }
|
11
|
+
#
|
12
|
+
# # optionaly define the following functions if the ORM does not support
|
13
|
+
# # this syntax - this should NOT use the orm_adapter, because we're testing that
|
14
|
+
# def create_model(klass, attrs = {})
|
15
|
+
# klass.create!(attrs)
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# def reload_model(model)
|
19
|
+
# model.class.find(model.id)
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
shared_examples_for "example app with orm_adapter" do
|
24
|
+
|
25
|
+
def create_model(klass, attrs = {})
|
26
|
+
klass.create!(attrs)
|
27
|
+
end
|
28
|
+
|
29
|
+
def reload_model(model)
|
30
|
+
model.class.find(model.id)
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "an ORM class" do
|
34
|
+
subject { note_class }
|
35
|
+
|
36
|
+
it "#to_adapter should return an adapter instance" do
|
37
|
+
subject.to_adapter.should be_a(OrmAdapter::Base)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "#to_adapter should return an adapter for the receiver" do
|
41
|
+
subject.to_adapter.klass.should == subject
|
42
|
+
end
|
43
|
+
|
44
|
+
it "#to_adapter should be cached" do
|
45
|
+
subject.to_adapter.object_id.should == subject.to_adapter.object_id
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "adapter instance" do
|
50
|
+
let(:note_adapter) { note_class.to_adapter }
|
51
|
+
let(:user_adapter) { user_class.to_adapter }
|
52
|
+
|
53
|
+
describe "#get!(id)" do
|
54
|
+
it "should return the instance with id if it exists" do
|
55
|
+
user = create_model(user_class)
|
56
|
+
user_adapter.get!(user.id).should == user
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should allow to_key like arguments" do
|
60
|
+
user = create_model(user_class)
|
61
|
+
user_adapter.get!(user.to_key).should == user
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should raise an error if there is no instance with that id" do
|
65
|
+
lambda { user_adapter.get!("nonexistent id") }.should raise_error
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "#get(id)" do
|
70
|
+
it "should return the instance with id if it exists" do
|
71
|
+
user = create_model(user_class)
|
72
|
+
user_adapter.get(user.id).should == user
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should allow to_key like arguments" do
|
76
|
+
user = create_model(user_class)
|
77
|
+
user_adapter.get(user.to_key).should == user
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should return nil if there is no instance with that id" do
|
81
|
+
user_adapter.get("nonexistent id").should be_nil
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "#find_first" do
|
86
|
+
describe "(conditions)" do
|
87
|
+
it "should return first model matching conditions, if it exists" do
|
88
|
+
user = create_model(user_class, :name => "Fred")
|
89
|
+
user_adapter.find_first(:name => "Fred").should == user
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should return nil if no conditions match" do
|
93
|
+
user_adapter.find_first(:name => "Betty").should == nil
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should return the first model if no conditions passed' do
|
97
|
+
user = create_model(user_class)
|
98
|
+
create_model(user_class)
|
99
|
+
user_adapter.find_first.should == user
|
100
|
+
end
|
101
|
+
|
102
|
+
it "when conditions contain associated object, should return first model if it exists" do
|
103
|
+
user = create_model(user_class)
|
104
|
+
note = create_model(note_class, :owner => user)
|
105
|
+
note_adapter.find_first(:owner => user).should == note
|
106
|
+
end
|
107
|
+
|
108
|
+
it "understands :id as a primary key condition (allowing scoped finding)" do
|
109
|
+
create_model(user_class, :name => "Fred")
|
110
|
+
user = create_model(user_class, :name => "Fred")
|
111
|
+
user_adapter.find_first(:id => user.id, :name => "Fred").should == user
|
112
|
+
user_adapter.find_first(:id => user.id, :name => "Not Fred").should be_nil
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "(:order => <order array>)" do
|
117
|
+
it "should return first model in specified order" do
|
118
|
+
user1 = create_model(user_class, :name => "Fred", :rating => 1)
|
119
|
+
user2 = create_model(user_class, :name => "Fred", :rating => 2)
|
120
|
+
user_adapter.find_first(:order => [:name, [:rating, :desc]]).should == user2
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe "(:conditions => <conditions hash>, :order => <order array>)" do
|
125
|
+
it "should return first model matching conditions, in specified order" do
|
126
|
+
user1 = create_model(user_class, :name => "Fred", :rating => 1)
|
127
|
+
user2 = create_model(user_class, :name => "Fred", :rating => 2)
|
128
|
+
user_adapter.find_first(:conditions => {:name => "Fred"}, :order => [:rating, :desc]).should == user2
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe "#find_all" do
|
134
|
+
describe "(conditions)" do
|
135
|
+
it "should return only models matching conditions" do
|
136
|
+
user1 = create_model(user_class, :name => "Fred")
|
137
|
+
user2 = create_model(user_class, :name => "Fred")
|
138
|
+
user3 = create_model(user_class, :name => "Betty")
|
139
|
+
user_adapter.find_all(:name => "Fred").to_a.should =~ [user1, user2]
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should return all models if no conditions passed" do
|
143
|
+
user1 = create_model(user_class, :name => "Fred")
|
144
|
+
user2 = create_model(user_class, :name => "Fred")
|
145
|
+
user3 = create_model(user_class, :name => "Betty")
|
146
|
+
user_adapter.find_all.to_a.should =~ [user1, user2, user3]
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should return empty array if no conditions match" do
|
150
|
+
user_adapter.find_all(:name => "Fred").should == []
|
151
|
+
end
|
152
|
+
|
153
|
+
it "when conditions contain associated object, should return first model if it exists" do
|
154
|
+
user1, user2 = create_model(user_class), create_model(user_class)
|
155
|
+
note1 = create_model(note_class, :owner => user1)
|
156
|
+
note2 = create_model(note_class, :owner => user2)
|
157
|
+
note_adapter.find_all(:owner => user2).should == [note2]
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe "(:order => <order array>)" do
|
162
|
+
it "should return all models in specified order" do
|
163
|
+
user1 = create_model(user_class, :name => "Fred", :rating => 1)
|
164
|
+
user2 = create_model(user_class, :name => "Fred", :rating => 2)
|
165
|
+
user3 = create_model(user_class, :name => "Betty", :rating => 1)
|
166
|
+
user_adapter.find_all(:order => [:name, [:rating, :desc]]).should == [user3, user2, user1]
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe "(:conditions => <conditions hash>, :order => <order array>)" do
|
171
|
+
it "should return only models matching conditions, in specified order" do
|
172
|
+
user1 = create_model(user_class, :name => "Fred", :rating => 1)
|
173
|
+
user2 = create_model(user_class, :name => "Fred", :rating => 2)
|
174
|
+
user3 = create_model(user_class, :name => "Betty", :rating => 1)
|
175
|
+
user_adapter.find_all(:conditions => {:name => "Fred"}, :order => [:rating, :desc]).should == [user2, user1]
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe "(:limit => <number of items>)" do
|
180
|
+
it "should return a limited set of matching models" do
|
181
|
+
user1 = create_model(user_class, :name => "Fred", :rating => 1)
|
182
|
+
user2 = create_model(user_class, :name => "Fred", :rating => 2)
|
183
|
+
user3 = create_model(user_class, :name => "Betty", :rating => 3)
|
184
|
+
user_adapter.find_all(:limit => 1, :order => [:rating, :asc]).should == [user1]
|
185
|
+
user_adapter.find_all(:limit => 2, :order => [:rating, :asc]).should == [user1, user2]
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe "(:offset => <offset number>) with limit (as DataMapper doesn't allow offset on its own)" do
|
190
|
+
it "should return an offset set of matching models" do
|
191
|
+
user1 = create_model(user_class, :name => "Fred", :rating => 1)
|
192
|
+
user2 = create_model(user_class, :name => "Fred", :rating => 2)
|
193
|
+
user3 = create_model(user_class, :name => "Betty", :rating => 3)
|
194
|
+
user_adapter.find_all(:limit => 3, :offset => 0, :order => [:rating, :asc]).should == [user1, user2, user3]
|
195
|
+
user_adapter.find_all(:limit => 3, :offset => 1, :order => [:rating, :asc]).should == [user2, user3]
|
196
|
+
user_adapter.find_all(:limit => 1, :offset => 1, :order => [:rating, :asc]).should == [user2]
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
describe "#create!(attributes)" do
|
202
|
+
it "should create a model with the passed attributes" do
|
203
|
+
user = user_adapter.create!(:name => "Fred")
|
204
|
+
reload_model(user).name.should == "Fred"
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should raise error when create fails" do
|
208
|
+
lambda { user_adapter.create!(:user => create_model(note_class)) }.should raise_error
|
209
|
+
end
|
210
|
+
|
211
|
+
it "when attributes contain an associated object, should create a model with the attributes" do
|
212
|
+
user = create_model(user_class)
|
213
|
+
note = note_adapter.create!(:owner => user)
|
214
|
+
reload_model(note).owner.should == user
|
215
|
+
end
|
216
|
+
|
217
|
+
it "when attributes contain an has_many assoc, should create a model with the attributes" do
|
218
|
+
notes = [create_model(note_class), create_model(note_class)]
|
219
|
+
user = user_adapter.create!(:notes => notes)
|
220
|
+
reload_model(user).notes.should == notes
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
describe "#destroy(instance)" do
|
225
|
+
it "should destroy the instance if it exists" do
|
226
|
+
user = create_model(user_class)
|
227
|
+
(!!user_adapter.destroy(user)).should == true # make it work with both RSpec 2.x and 3.x
|
228
|
+
user_adapter.get(user.id).should be_nil
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should return nil if passed with an invalid instance" do
|
232
|
+
user_adapter.destroy("nonexistent instance").should be_nil
|
233
|
+
end
|
234
|
+
|
235
|
+
it "should not destroy the instance if it doesn't match the model class" do
|
236
|
+
user = create_model(user_class)
|
237
|
+
note_adapter.destroy(user).should be_nil
|
238
|
+
user_adapter.get(user.id).should == user
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
data/spec/models.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
class User
|
2
|
+
include NoBrainer::Document
|
3
|
+
field :name
|
4
|
+
field :rating
|
5
|
+
has_many :notes, foreign_key: :owner_id
|
6
|
+
end
|
7
|
+
|
8
|
+
class Note
|
9
|
+
include NoBrainer::Document
|
10
|
+
field :body, default: 'made by orm'
|
11
|
+
belongs_to :owner, foreign_key: :owner_id, class_name: 'User'
|
12
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'models'
|
2
|
+
require 'example_app_shared'
|
3
|
+
|
4
|
+
NoBrainer.configure do |config|
|
5
|
+
config.rethinkdb_url = 'rethinkdb://localhost/orm_adapter_spec'
|
6
|
+
# We don't care about this data. We do care about speed.
|
7
|
+
config.durability = :soft
|
8
|
+
end
|
9
|
+
|
10
|
+
describe NoBrainer::Document::OrmAdapter do
|
11
|
+
before do
|
12
|
+
User.destroy_all
|
13
|
+
Note.destroy_all
|
14
|
+
end
|
15
|
+
|
16
|
+
it_should_behave_like "example app with orm_adapter" do
|
17
|
+
let(:user_class) { User }
|
18
|
+
let(:note_class) { Note }
|
19
|
+
end
|
20
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: orm_adapter-nobrainer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Colin Mattson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.6.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rethinkdb
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.13'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.13'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: orm_adapter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.5.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.5.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: nobrainer
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.15.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.15.0
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- colinmattson@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- Gemfile
|
121
|
+
- LICENSE.txt
|
122
|
+
- README.md
|
123
|
+
- Rakefile
|
124
|
+
- lib/orm_adapter-nobrainer.rb
|
125
|
+
- lib/orm_adapter-nobrainer/nobrainer.rb
|
126
|
+
- lib/orm_adapter-nobrainer/version.rb
|
127
|
+
- orm_adapter-nobrainer.gemspec
|
128
|
+
- spec/example_app_shared.rb
|
129
|
+
- spec/models.rb
|
130
|
+
- spec/no_brainer_spec.rb
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
homepage: https://github.com/cmattson/orm_adapter-nobrainer
|
133
|
+
licenses:
|
134
|
+
- MIT
|
135
|
+
metadata: {}
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 2.4.1
|
153
|
+
signing_key:
|
154
|
+
specification_version: 4
|
155
|
+
summary: NoBrainer support for orm_adapter
|
156
|
+
test_files:
|
157
|
+
- spec/example_app_shared.rb
|
158
|
+
- spec/models.rb
|
159
|
+
- spec/no_brainer_spec.rb
|
160
|
+
- spec/spec_helper.rb
|
161
|
+
has_rdoc:
|