dm-ar-finders 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,4 +1,8 @@
1
- === 0.10.0 / 2009-10-15
1
+ === 0.10.1 / 2009-09-30
2
+
3
+ * No changes this version
4
+
5
+ === 0.10.0 / 2009-09-15
2
6
 
3
7
  * Updated to work with dm-core 0.10.0
4
8
 
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module ARFinders
3
- VERSION = '0.10.0'.freeze
3
+ VERSION = '0.10.1'.freeze
4
4
  end
5
5
  end
@@ -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
- found = GreenSmoothie.find_by_sql <<-SQL, :properties => [:id, :name]
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
- properties = found.first.loaded_properties
164
- properties.should have(2).properties
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
- found = GreenSmoothie.find_by_sql <<-SQL, :properties => :id
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
- properties = found.first.loaded_properties
175
- properties.should have(1).properties
176
- properties.should include(GreenSmoothie.properties[:id])
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
- found = GreenSmoothie.find_by_sql <<-SQL, :properties => GreenSmoothie.properties
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
- properties = found.first.loaded_properties
185
- properties.should have(2).properties
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
- found = GreenSmoothie.find_by_sql <<-SQL, :properties => GreenSmoothie.properties[:id]
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
- properties = found.first.loaded_properties
196
- properties.should have(1).property
197
- properties.first.should == GreenSmoothie.properties[:id]
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
- found = GreenSmoothie.find_by_sql <<-SQL, :properties => GreenSmoothie.properties.to_a
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
- properties = found.first.loaded_properties
206
- properties.should have(2).properties
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
- found = GreenSmoothie.find_by_sql <<-SQL, :properties => GreenSmoothie.properties
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
- properties = found.first.loaded_properties
217
- properties.should have(2).properties
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.loaded_properties.should == GreenSmoothie.properties
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.0
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-16 00:00:00 -07:00
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