dm-ar-finders 0.10.0 → 0.10.1
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/History.rdoc +5 -1
- data/lib/dm-ar-finders/version.rb +1 -1
- data/spec/integration/ar-finders_spec.rb +36 -29
- metadata +13 -4
data/History.rdoc
CHANGED
@@ -156,67 +156,73 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
156
156
|
|
157
157
|
describe ':properties option' do
|
158
158
|
it 'should accept an array of symbols' do
|
159
|
-
|
159
|
+
properties = GreenSmoothie.properties
|
160
|
+
|
161
|
+
found = GreenSmoothie.find_by_sql <<-SQL, :properties => properties.map { |property| property.name }
|
160
162
|
SELECT id, name FROM green_smoothies LIMIT 1
|
161
163
|
SQL
|
162
164
|
|
163
|
-
|
164
|
-
properties.should
|
165
|
-
properties.should include(GreenSmoothie.properties[:id])
|
166
|
-
properties.should include(GreenSmoothie.properties[:name])
|
165
|
+
resource = found.first
|
166
|
+
properties.each { |property| property.should be_loaded(resource) }
|
167
167
|
end
|
168
168
|
|
169
169
|
it 'should accept a single Symbol' do
|
170
|
-
|
170
|
+
property = GreenSmoothie.properties[:id]
|
171
|
+
|
172
|
+
found = GreenSmoothie.find_by_sql <<-SQL, :properties => property.name
|
171
173
|
SELECT id, name FROM green_smoothies LIMIT 1
|
172
174
|
SQL
|
173
175
|
|
174
|
-
|
175
|
-
|
176
|
-
|
176
|
+
resource = found.first
|
177
|
+
|
178
|
+
property.should be_loaded(resource)
|
179
|
+
GreenSmoothie.properties[:name].should_not be_loaded(resource)
|
177
180
|
end
|
178
181
|
|
179
182
|
it 'should accept a PropertySet' do
|
180
|
-
|
183
|
+
properties = GreenSmoothie.properties
|
184
|
+
|
185
|
+
found = GreenSmoothie.find_by_sql <<-SQL, :properties => properties
|
181
186
|
SELECT id, name FROM green_smoothies LIMIT 1
|
182
187
|
SQL
|
183
188
|
|
184
|
-
|
185
|
-
properties.should
|
186
|
-
properties.should include(GreenSmoothie.properties[:id])
|
187
|
-
properties.should include(GreenSmoothie.properties[:name])
|
189
|
+
resource = found.first
|
190
|
+
properties.each { |property| property.should be_loaded(resource) }
|
188
191
|
end
|
189
192
|
|
190
193
|
it 'should accept a single property' do
|
191
|
-
|
194
|
+
property = GreenSmoothie.properties[:id]
|
195
|
+
|
196
|
+
found = GreenSmoothie.find_by_sql <<-SQL, :properties => property
|
192
197
|
SELECT id, name FROM green_smoothies LIMIT 1
|
193
198
|
SQL
|
194
199
|
|
195
|
-
|
196
|
-
|
197
|
-
|
200
|
+
resource = found.first
|
201
|
+
|
202
|
+
property.should be_loaded(resource)
|
203
|
+
GreenSmoothie.properties[:name].should_not be_loaded(resource)
|
198
204
|
end
|
199
205
|
|
200
206
|
it 'should accept an array of Properties' do
|
201
|
-
|
207
|
+
properties = GreenSmoothie.properties.to_a
|
208
|
+
|
209
|
+
found = GreenSmoothie.find_by_sql <<-SQL, :properties => properties
|
202
210
|
SELECT id, name FROM green_smoothies LIMIT 1
|
203
211
|
SQL
|
204
212
|
|
205
|
-
|
206
|
-
properties.should
|
207
|
-
properties.should include(GreenSmoothie.properties[:id])
|
208
|
-
properties.should include(GreenSmoothie.properties[:name])
|
213
|
+
resource = found.first
|
214
|
+
properties.each { |property| property.should be_loaded(resource) }
|
209
215
|
end
|
210
216
|
|
211
217
|
it 'should use the given properties in preference over those in the SQL query' do
|
212
|
-
|
218
|
+
properties = GreenSmoothie.properties
|
219
|
+
|
220
|
+
found = GreenSmoothie.find_by_sql <<-SQL, :properties => properties
|
213
221
|
SELECT id, name FROM green_smoothies LIMIT 1
|
214
222
|
SQL
|
215
223
|
|
216
|
-
|
217
|
-
properties.should
|
218
|
-
properties.should include(GreenSmoothie.properties[:id])
|
219
|
-
properties.should include(GreenSmoothie.properties[:name])
|
224
|
+
resource = found.first
|
225
|
+
properties.each { |property| property.should be_loaded(resource) }
|
220
226
|
end
|
221
227
|
|
222
228
|
it 'should use the default properties if none are specified' do
|
@@ -224,7 +230,8 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
224
230
|
SELECT id, name FROM green_smoothies LIMIT 1
|
225
231
|
SQL
|
226
232
|
|
227
|
-
found.first
|
233
|
+
resource = found.first
|
234
|
+
GreenSmoothie.properties.each { |property| property.should be_loaded(resource) }
|
228
235
|
end
|
229
236
|
end
|
230
237
|
end # find_by_sql
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-ar-finders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John W Higgins
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: dm-core
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - "="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.10.1
|
24
|
+
version:
|
16
25
|
description: DataMapper plugin providing ActiveRecord-style finders
|
17
26
|
email:
|
18
27
|
- john [a] wishVPS [d] com
|