ardm 0.4.0.ar427 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -14,15 +14,14 @@ group :test do
14
14
  end
15
15
 
16
16
  group :ar do
17
- gem 'activerecord', '= 4.2.7.1'
17
+ gem 'activerecord', '~> 4.0.0'
18
18
  end
19
19
 
20
20
  group :dm do
21
- gem 'ardm-core', '~> 1.3'
21
+ gem 'dm-core', '~> 1.2'
22
22
  gem 'dm-sqlite-adapter', '~> 1.2'
23
- # gem 'dm-types', '~> 1.2', git: "git://github.com/engineyard/dm-types.git", branch: "1.2-multijson"
24
- gem "ardm-types", '~> 1.1'
23
+ gem 'dm-types', '~> 1.2', git: "git://github.com/engineyard/dm-types.git", branch: "1.2-multijson"
25
24
  gem 'dm-validations', '~> 1.2'
26
- gem 'ardm-transactions', '~> 1.2'
27
- gem 'ardm-migrations', '~> 1.3'
25
+ gem 'dm-transactions', '~> 1.2'
26
+ gem 'dm-migrations', '~> 1.2'
28
27
  end
@@ -45,24 +45,3 @@ end
45
45
  ::ActiveRecord::Relation.class_eval do
46
46
  include Ardm::Ar::Relation
47
47
  end
48
-
49
- ActiveRecord::Scoping::Named::ClassMethods.class_eval do
50
- def all(options = {})
51
- scope_of_all = if current_scope
52
- current_scope.clone
53
- else
54
- default_scoped
55
- end
56
- if options.any?
57
- scope_of_all.all.all(options)
58
- else
59
- scope_of_all
60
- end
61
- end
62
- end
63
-
64
- # ActiveRecord::ConnectionAdapters::Column.class_eval do
65
- # def default=(arg)
66
- # @default = arg
67
- # end
68
- # end
@@ -113,61 +113,28 @@ module Ardm
113
113
  end
114
114
 
115
115
  def columns
116
- @columns ||= _ardm_load_columns(super)
116
+ @columns ||= _ardm_load_columns
117
117
  end
118
118
 
119
- def _ardm_load_columns(ar_columns)
120
- to_return = ar_columns
121
- properties.each do |property|
119
+ def _ardm_load_columns
120
+ properties.map do |property|
122
121
  sql_type = connection.type_to_sql(
123
122
  property.dump_as.name.to_sym,
124
123
  property.options[:limit],
125
124
  property.options[:precision],
126
125
  property.options[:scale]
127
126
  )
128
- if column = ar_columns.detect{|c| c.name.to_s == property.name.to_s}
129
- #TODO: property.key?
130
- err_prefix = "WARNING: DM/AR mismatch for #{self.name}.#{property.name.to_s} on"
131
-
132
- #TODO: do some fuzzy matching so we only get warnings when there is a clear conflict:
133
- # if column.sql_type != sql_type
134
- # puts "#{err_prefix} sql_type #{sql_type} vs #{column.sql_type}"
135
- # end
136
-
137
- if column.null != property.allow_nil?
138
- puts "#{err_prefix} allow_nil #{property.allow_nil?} vs #{column.null}"
139
- end
140
127
 
141
- #TODO: is this needed, or does default-setting get handled elsewhere?
142
- # if column.default != property.default
143
- # puts "#{err_prefix} default #{property.default} vs #{column.default}"
144
- # end
145
- # column.default = property.default
128
+ column = ::ActiveRecord::ConnectionAdapters::Column.new(
129
+ property.field.to_s, #property.name.to_s,
130
+ nil,#property.dump(property.default),
131
+ sql_type,
132
+ property.allow_nil?
133
+ )
146
134
 
147
- else
148
- puts "WARNING: DM defines property #{self.name}.#{property.name.to_s} but AR found no corresponding column"
149
- end
135
+ column.primary = property.key?
136
+ column
150
137
  end
151
- to_return
152
-
153
- # WAS:
154
- # sql_type = connection.type_to_sql(
155
- # property.dump_as.name.to_sym,
156
- # property.options[:limit],
157
- # property.options[:precision],
158
- # property.options[:scale]
159
- # )
160
- #
161
- # column = ::ActiveRecord::ConnectionAdapters::Column.new(
162
- # property.field.to_s, #property.name.to_s, #name
163
- # nil,#property.dump(property.default), #default
164
- # property.cast_type,
165
- # sql_type, #sql_type
166
- # property.allow_nil? #null
167
- # )
168
- #
169
- # column.primary = property.key?
170
- # column
171
138
  end
172
139
 
173
140
  # Hook into the query system when we would be finding composed_of
@@ -342,9 +309,6 @@ module Ardm
342
309
  end
343
310
  read_attribute property.field
344
311
  end
345
- rescue => e
346
- puts "ERROR on attribute_get #{self.class.name}.#{name}"
347
- raise e
348
312
  end
349
313
 
350
314
  # This not the same as write_attribute in AR
@@ -11,19 +11,9 @@ module Ardm
11
11
  alias_method :update_without_ardm, :update
12
12
  alias_method :first_without_ardm, :first
13
13
  alias_method :first_without_ardm!, :first!
14
- alias_method :equal_without_ardm, :==
15
- alias_method :method_missing_without_ardm, :method_missing
16
14
 
17
15
  # we need to overrite the implementation in the class
18
16
  class_eval do
19
- def ==(other)
20
- result = self.equal_without_ardm(other)
21
- if !result && other.is_a?(Relation)
22
- result ||= self.equal_without_ardm(other.to_a)
23
- end
24
- result
25
- end
26
-
27
17
  def update(*a)
28
18
  if a.size == 1
29
19
  # need to translate attributes
@@ -70,20 +60,15 @@ module Ardm
70
60
  def first_or_initialize(attributes = nil, options = {}, &block)
71
61
  all(attributes).first || all(attributes).create(options, &block)
72
62
  end
73
-
74
- def method_missing(method, *args, &block)
75
- if assoc = self.model.reflect_on_association(method)
76
- puts "WARNING: suspected query chain (not supported) a #{self.model.name} #{assoc.macro} '#{method}'"
77
- puts caller[0,3]
78
- if ENV["RAISE_ON_QUERY_CHAIN_CALLS"]
79
- raise "WARNING: suspected query chain (not supported) a #{self.model.name} #{assoc.macro} '#{method}'"
80
- end
81
- end
82
- method_missing_without_ardm(method, *args, &block)
83
- end
84
63
  end
85
64
  end
86
65
 
66
+ def method_missing(meth, *a, &b)
67
+ super
68
+ rescue => e
69
+ raise NoMethodError, "Relation chain? #{self}.#{meth}\n#{e}"
70
+ end
71
+
87
72
  def all(options={})
88
73
  apply_finder_options(options)
89
74
  end
@@ -116,33 +101,21 @@ module Ardm
116
101
  end
117
102
 
118
103
  conditions.each do |key, value|
119
- if value.is_a?(ActiveRecord::Relation)
120
- value = value.to_a
121
- end
122
- key_to_reflect_on = key
123
- if key.is_a?(Ardm::Query::Operator)
124
- key_to_reflect_on = key.target
125
- end
126
- if assoc = relation.reflect_on_association(key_to_reflect_on)
104
+ if assoc = relation.reflect_on_association(key)
127
105
  conditions.delete(key)
128
106
  # strip out assocations
129
107
  case assoc.macro
130
108
  when :belongs_to
131
- if key.is_a?(Ardm::Query::Operator)
132
- #TODO: might not work for all types of value... but works when value is nil (existing DM specs drive development)
133
- relation = key.to_arel(self, value).scope
134
- else
135
- id = value.is_a?(Hash) ? value.with_indifferent_access[:id] : value
136
- relation = if value.is_a?(::ActiveRecord::Relation)
137
- if value.values.empty?
138
- relation.where.not(assoc.foreign_key => nil)
139
- else
140
- relation.where(assoc.foreign_key => value)
141
- end
109
+ id = value.is_a?(Hash) ? value.with_indifferent_access[:id] : value
110
+ relation = if value.is_a?(::ActiveRecord::Relation)
111
+ if value.values.empty?
112
+ relation.where.not(assoc.foreign_key => nil)
142
113
  else
143
- relation.where(assoc.foreign_key => id)
114
+ relation.where(assoc.foreign_key => value)
144
115
  end
145
- end
116
+ else
117
+ relation.where(assoc.foreign_key => id)
118
+ end
146
119
  when :has_one
147
120
  foreign_class = assoc.options[:class_name].constantize
148
121
  foreign_key = assoc.foreign_key
@@ -154,47 +127,21 @@ module Ardm
154
127
  end
155
128
 
156
129
  relation = if value.is_a?(::ActiveRecord::Base)
157
- relation.where(parent_key => value.send(foreign_key))
130
+ relation.where(parent_key => value.send(assoc.foreign_key))
158
131
  elsif value.is_a?(::ActiveRecord::Relation)
159
132
  relation.where(parent_key => value.select(foreign_key))
160
133
  elsif value.nil?
161
- if key.is_a?(Ardm::Query::Operator) && (key.operator == :not_eq)
162
- relation.where(parent_key => foreign_class.select(foreign_key).compact.map(&foreign_key).to_a)
163
- else
164
- relation.where.not(parent_key => foreign_class.select(foreign_key).compact.map(&foreign_key).to_a)
165
- end
166
- #should EQ:
167
- # relation.select{|o| o.send(assoc.name) == value}
168
- elsif value.is_a?(::Array) && value.first.is_a?(::ActiveRecord::Base)
169
- foreign_key_values = value.map(&foreign_key.to_sym)
170
- relation.where(parent_key => foreign_key_values)
134
+ relation.where.not(parent_key => foreign_class.select(foreign_key).where.not(foreign_key => value))
171
135
  else
172
136
  relation.where(parent_key => foreign_class.select(foreign_key).where(value))
173
137
  end
174
138
  when :has_many
175
- if assoc.options[:through]
176
- raise "Unsupported query on has_many through (#{options.inspect})"
177
- end
178
- foreign_class = assoc.options[:class_name] && assoc.options[:class_name].constantize
139
+ foreign_class = assoc.options[:class_name].constantize
179
140
  foreign_key = assoc.foreign_key
180
141
  parent_key = assoc.options[:child_key] || klass.primary_key
181
142
 
182
- relation = if value.is_a?(::ActiveRecord::Base)
183
- relation.where(id: foreign_class.where(parent_key => value.send(parent_key)).map(&foreign_key))
184
- elsif value.is_a?(Hash)
185
- relation.where(id: foreign_class.where(parent_key => value[parent_key.to_s]).map(&foreign_key))
186
- elsif value.is_a?(::ActiveRecord::Relation)
187
- relation.where(id: foreign_class.where(parent_key => value.select(parent_key).to_a).map(&foreign_key))
188
- elsif value.is_a?(Array)
189
- relation.where(id: foreign_class.where(parent_key => value.map{|v| v.send(parent_key)}).map(&foreign_key))
190
- elsif value.nil?
191
- raise "Unsupported query on has_many (#{options.inspect})"
192
- #better to fail than return the wrong thing
193
- # if key.is_a?(Ardm::Query::Operator) && (key.operator == :not_eq)
194
- # relation.where(parent_key => foreign_class.select(foreign_key).compact.map(&foreign_key).to_a)
195
- # else
196
- # relation.where.not(parent_key => foreign_class.select(foreign_key).compact.map(&foreign_key).to_a)
197
- # end
143
+ relation = if value.is_a?(::ActiveRecord::Relation)
144
+ relation.where(foreign_key => value)
198
145
  else
199
146
  relation.where(parent_key => foreign_class.select(foreign_class.primary_key).where.not(foreign_key => value))
200
147
  end
@@ -247,15 +194,6 @@ module Ardm
247
194
  end
248
195
  end
249
196
 
250
- def query
251
- self.to_sql
252
- end
253
-
254
- def ==(other)
255
- puts "COMPARING to #{other}"
256
- super(other)
257
- end
258
-
259
197
  def destroy!
260
198
  delete_all
261
199
  end
@@ -9,8 +9,6 @@ module Ardm
9
9
  load_as ::Object
10
10
  dump_as ::Integer
11
11
 
12
- class InvalidValueError < StandardError; end
13
-
14
12
  def initialize(model, name, options = {})
15
13
  @flag_map = {}
16
14
 
@@ -27,18 +25,14 @@ module Ardm
27
25
  end
28
26
 
29
27
  def load(value)
30
- flag_map[value.to_i] || value
28
+ flag_map[value.to_i]
31
29
  end
32
30
 
33
31
  def dump(value)
34
- result = case value
35
- when ::Array then value.collect { |v| dump(v) }
36
- else flag_map.invert[typecast(value)]
37
- end
38
- if value && !result
39
- raise InvalidValueError.new("Invalid value for ENUM #{self.model.name}.#{name}, given: #{value}")
32
+ case value
33
+ when ::Array then value.collect { |v| dump(v) }
34
+ else flag_map.invert[typecast(value)]
40
35
  end
41
- result
42
36
  end
43
37
 
44
38
  def typecast(value)
@@ -1,3 +1,3 @@
1
1
  module Ardm
2
- VERSION = '0.4.0.ar427'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -57,13 +57,22 @@ try_spec do
57
57
 
58
58
  describe 'with value unknown to enumeration property' do
59
59
  before do
60
- @resource = Ardm::Fixtures::Ticket.new
60
+ @resource = Ardm::Fixtures::Ticket.new(:status => :undecided)
61
+ @resource.valid?
61
62
  end
62
63
 
63
- it "raises" do
64
- expect { @resource.status = :undecided }.to(raise_error(Ardm::Property::Enum::InvalidValueError) do |error|
65
- expect(error.message).to eq("Invalid value for ENUM Ardm::Fixtures::Ticket.status, given: undecided")
66
- end)
64
+ # TODO: consider sharing shared spec exampels with dm-validations,
65
+ # which has 'invalid model' shared group
66
+ it 'is invalid (auto validation for :within kicks in)' do
67
+ expect(@resource).not_to be_valid
68
+ end
69
+
70
+ it 'has errors' do
71
+ expect(@resource.errors).not_to be_empty
72
+ end
73
+
74
+ it 'has a meaningful error message on invalid property' do
75
+ expect(@resource.errors[:status]).to include('must be one of unconfirmed, confirmed, assigned, resolved, not_applicable')
67
76
  end
68
77
  end
69
78
  end
@@ -5,10 +5,6 @@ try_spec do
5
5
  require './spec/fixtures/network_node'
6
6
 
7
7
  describe Ardm::Fixtures::NetworkNode do
8
- before do
9
- skip "IPAddress property not working"
10
- end
11
-
12
8
  def run_ipv4
13
9
  be_runs_ipv4
14
10
  end
@@ -25,9 +25,9 @@ shared_examples 'Finder Interface' do
25
25
  skip(message) if condition
26
26
  end
27
27
 
28
- # it 'should be Enumerable', :dm do
29
- # expect(@articles).to be_kind_of(Enumerable)
30
- # end
28
+ it 'should be Enumerable', :dm do
29
+ expect(@articles).to be_kind_of(Enumerable)
30
+ end
31
31
 
32
32
  [ :[], :slice ].each do |method|
33
33
  it { expect(@articles).to respond_to(method) }
@@ -60,7 +60,6 @@ shared_examples 'Finder Interface' do
60
60
  end
61
61
 
62
62
  it 'should return a Collection', :dm do
63
- skip "doesn't return a collection anymore..."
64
63
  expect(@return).to be_kind_of(Ardm::Collection)
65
64
  @return.should be_kind_of(Ardm::Collection)
66
65
  end
@@ -70,7 +69,6 @@ shared_examples 'Finder Interface' do
70
69
  end
71
70
 
72
71
  it 'should scope the Collection', :dm do
73
- skip "can't call reload on a non-collection"
74
72
  expect(@resources.reload).to eq(@copy.entries.send(method, 5, 5))
75
73
  end
76
74
  end
@@ -81,7 +79,6 @@ shared_examples 'Finder Interface' do
81
79
  end
82
80
 
83
81
  it 'should return a Collection', :dm do
84
- skip "doesn't return a collection anymore..."
85
82
  expect(@return).to be_kind_of(Ardm::Collection)
86
83
  end
87
84
 
@@ -90,7 +87,6 @@ shared_examples 'Finder Interface' do
90
87
  end
91
88
 
92
89
  it 'should scope the Collection', :dm do
93
- skip "can't call reload on a non-collection"
94
90
  expect(@resources.reload).to eq(@copy.entries.send(method, 5..10))
95
91
  end
96
92
  end
@@ -113,7 +109,6 @@ shared_examples 'Finder Interface' do
113
109
 
114
110
  describe 'with a negative offset and length' do
115
111
  before do
116
- skip "doesn't return a collection anymore..."
117
112
  @return = @resources = @articles.send(method, -5, 5)
118
113
  end
119
114
 
@@ -126,7 +121,6 @@ shared_examples 'Finder Interface' do
126
121
  end
127
122
 
128
123
  it 'should scope the Collection', :dm do
129
- skip "can't call reload on a non-collection"
130
124
  expect(@resources.reload).to eq(@copy.entries.send(method, -5, 5))
131
125
  end
132
126
  end
@@ -137,7 +131,6 @@ shared_examples 'Finder Interface' do
137
131
  end
138
132
 
139
133
  it 'should return a Collection', :dm do
140
- skip "doesn't return a collection anymore..."
141
134
  expect(@return).to be_kind_of(Ardm::Collection)
142
135
  end
143
136
 
@@ -146,7 +139,6 @@ shared_examples 'Finder Interface' do
146
139
  end
147
140
 
148
141
  it 'should scope the Collection', :dm do
149
- skip "can't call reload on a non-collection"
150
142
  expect(@resources.reload).to eq(@copy.entries.send(method, -5..-2))
151
143
  end
152
144
  end
@@ -157,7 +149,6 @@ shared_examples 'Finder Interface' do
157
149
  end
158
150
 
159
151
  it 'should return a Collection', :dm do
160
- skip "doesn't return a collection anymore..."
161
152
  expect(@return).to be_kind_of(Ardm::Collection)
162
153
  end
163
154
 
@@ -188,12 +179,10 @@ shared_examples 'Finder Interface' do
188
179
  end
189
180
 
190
181
  it 'should return a Collection' do
191
- skip "doesn't return a collection anymore..."
192
182
  expect(@return).to be_kind_of(Ardm::Collection)
193
183
  end
194
184
 
195
185
  it 'should be empty' do
196
- skip "it's nil"
197
186
  expect(@return).to be_empty
198
187
  end
199
188
  end
@@ -204,12 +193,10 @@ shared_examples 'Finder Interface' do
204
193
  end
205
194
 
206
195
  it 'should return a Collection' do
207
- skip "doesn't return a collection anymore..."
208
196
  expect(@return).to be_kind_of(Ardm::Collection)
209
197
  end
210
198
 
211
199
  it 'should be empty' do
212
- skip "it's nil"
213
200
  expect(@return).to be_empty
214
201
  end
215
202
  end
@@ -315,7 +302,6 @@ shared_examples 'Finder Interface' do
315
302
 
316
303
  describe 'with a query that is out of range', :dm do
317
304
  it 'should raise an exception' do
318
- skip "doesn't raise"
319
305
  expect {
320
306
  @articles.all(:limit => 10).all(:offset => 10)
321
307
  }.to raise_error(RangeError, 'offset 10 and limit 0 are outside allowed range')
@@ -337,7 +323,6 @@ shared_examples 'Finder Interface' do
337
323
  end
338
324
 
339
325
  it 'should have a valid query', :dm do
340
- skip "undefined method `valid?' for #<String"
341
326
  expect(@return.query).to be_valid
342
327
  end
343
328
  end
@@ -356,7 +341,6 @@ shared_examples 'Finder Interface' do
356
341
  end
357
342
 
358
343
  it 'should have a valid query', :dm do
359
- skip "undefined method `valid?' for #<String"
360
344
  expect(@return.query).to be_valid
361
345
  end
362
346
  end
@@ -366,6 +350,7 @@ shared_examples 'Finder Interface' do
366
350
  @collection = @article_model.all(
367
351
  Hash[ @article_model.key.zip(@original.key) ]
368
352
  )
353
+
369
354
  @return = @articles.all(:original => @collection)
370
355
  end
371
356
 
@@ -378,7 +363,6 @@ shared_examples 'Finder Interface' do
378
363
  end
379
364
 
380
365
  it 'should have a valid query', :dm do
381
- skip "undefined method `valid?' for #<String"
382
366
  expect(@return.query).to be_valid
383
367
  end
384
368
 
@@ -398,7 +382,6 @@ shared_examples 'Finder Interface' do
398
382
  end
399
383
 
400
384
  it 'should not have a valid query', :dm do
401
- skip "undefined method `valid?' for #<String"
402
385
  expect(@return.query).not_to be_valid
403
386
  end
404
387
  end
@@ -417,7 +400,6 @@ shared_examples 'Finder Interface' do
417
400
  end
418
401
 
419
402
  it 'should have a valid query', :dm do
420
- skip "undefined method `valid?' for #<String"
421
403
  expect(@return.query).to be_valid
422
404
  end
423
405
 
@@ -446,7 +428,6 @@ shared_examples 'Finder Interface' do
446
428
  end
447
429
 
448
430
  it 'should have a valid query', :dm do
449
- skip "undefined method `valid?' for #<String"
450
431
  expect(@return.query).to be_valid
451
432
  end
452
433
 
@@ -463,7 +444,6 @@ shared_examples 'Finder Interface' do
463
444
 
464
445
  describe 'with a Hash' do
465
446
  before do
466
- skip "query with Hash is not currently supported"
467
447
  @return = @articles.all(:previous => @new.attributes)
468
448
  end
469
449
 
@@ -476,7 +456,6 @@ shared_examples 'Finder Interface' do
476
456
  end
477
457
 
478
458
  it 'should have a valid query', :dm do
479
- skip "undefined method `valid?' for #<String"
480
459
  expect(@return.query).to be_valid
481
460
  end
482
461
  end
@@ -495,7 +474,6 @@ shared_examples 'Finder Interface' do
495
474
  end
496
475
 
497
476
  it 'should have a valid query', :dm do
498
- skip "undefined method `valid?' for #<String"
499
477
  expect(@return.query).to be_valid
500
478
  end
501
479
  end
@@ -518,7 +496,6 @@ shared_examples 'Finder Interface' do
518
496
  end
519
497
 
520
498
  it 'should have a valid query', :dm do
521
- skip "undefined method `valid?' for #<String"
522
499
  expect(@return.query).to be_valid
523
500
  end
524
501
  end
@@ -537,7 +514,6 @@ shared_examples 'Finder Interface' do
537
514
  end
538
515
 
539
516
  it 'should not have a valid query', :dm do
540
- skip "query is just a string now..."
541
517
  expect(@return.query).not_to be_valid
542
518
  end
543
519
  end
@@ -562,7 +538,6 @@ shared_examples 'Finder Interface' do
562
538
  end
563
539
 
564
540
  it 'should have a valid query', :dm do
565
- skip "undefined method `valid?' for #<String"
566
541
  expect(@return.query).to be_valid
567
542
  end
568
543
 
@@ -571,7 +546,6 @@ shared_examples 'Finder Interface' do
571
546
  # ar:
572
547
  # SELECT "articles".* FROM "articles" WHERE ("articles"."original_id" IS NOT NULL)
573
548
  # SELECT "articles".* FROM "articles" WHERE ("articles"."id" NOT IN (SELECT original_id FROM "articles" WHERE ("articles"."original_id" IS NOT NULL)))
574
- skip "TODO: come back here"
575
549
  puts "@return:#{@return.to_sql}"
576
550
  puts "negated:#{@articles.all(:previous.not => @article_model.all(:original.not => nil)).to_sql}"
577
551
  expect(@return).to eq(@articles.all(:previous.not => @article_model.all(:original.not => nil)))
@@ -592,7 +566,6 @@ shared_examples 'Finder Interface' do
592
566
  end
593
567
 
594
568
  it 'should have a valid query', :dm do
595
- skip "undefined method `valid?' for #<String"
596
569
  expect(@return.query).to be_valid
597
570
  end
598
571
 
@@ -616,12 +589,11 @@ shared_examples 'Finder Interface' do
616
589
  expect(@return).to be_kind_of(Ardm::Collection)
617
590
  end
618
591
 
619
- it 'should be expected Resources', focus: true do
592
+ it 'should be expected Resources' do
620
593
  expect(@return).to eq([ @article ])
621
594
  end
622
595
 
623
596
  it 'should have a valid query', :dm do
624
- skip "undefined method `valid?' for #<String"
625
597
  expect(@return.query).to be_valid
626
598
  end
627
599
  end
@@ -640,7 +612,6 @@ shared_examples 'Finder Interface' do
640
612
  end
641
613
 
642
614
  it 'should have a valid query', :dm do
643
- skip "undefined method `valid?' for #<String"
644
615
  expect(@return.query).to be_valid
645
616
  end
646
617
  end
@@ -663,7 +634,6 @@ shared_examples 'Finder Interface' do
663
634
  end
664
635
 
665
636
  it 'should have a valid query', :dm do
666
- skip "undefined method `valid?' for #<String"
667
637
  expect(@return.query).to be_valid
668
638
  end
669
639
  end
@@ -682,14 +652,12 @@ shared_examples 'Finder Interface' do
682
652
  end
683
653
 
684
654
  it 'should not have a valid query' do
685
- skip "valid can't be checked on query anymore.."
686
655
  expect(@return.query).not_to be_valid
687
656
  end
688
657
  end
689
658
 
690
659
  describe 'with a nil value' do
691
660
  before do
692
- skip "nil on has_many not supported (explicitly)"
693
661
  @return = @articles.all(:revisions => nil)
694
662
  end
695
663
 
@@ -709,7 +677,6 @@ shared_examples 'Finder Interface' do
709
677
  end
710
678
 
711
679
  it 'should have a valid query', :dm do
712
- skip "undefined method `valid?' for #<String"
713
680
  expect(@return.query).to be_valid
714
681
  end
715
682
 
@@ -720,7 +687,6 @@ shared_examples 'Finder Interface' do
720
687
 
721
688
  describe 'with a negated nil value' do
722
689
  before do
723
- skip "nil on has_many not supported (explicitly)"
724
690
  @return = @articles.all(:revisions.not => nil)
725
691
  end
726
692
 
@@ -733,7 +699,6 @@ shared_examples 'Finder Interface' do
733
699
  end
734
700
 
735
701
  it 'should have a valid query', :dm do
736
- skip "undefined method `valid?' for #<String"
737
702
  expect(@return.query).to be_valid
738
703
  end
739
704
 
@@ -745,7 +710,6 @@ shared_examples 'Finder Interface' do
745
710
 
746
711
  describe 'with a query using a m:m relationship' do
747
712
  before do
748
- skip "has_many through not supported (explicitly)"
749
713
  @publication = @article.publications.create(:name => 'Ardm Now')
750
714
  end
751
715
 
@@ -765,7 +729,6 @@ shared_examples 'Finder Interface' do
765
729
  end
766
730
 
767
731
  it 'should have a valid query', :dm do
768
- skip "undefined method `valid?' for #<String"
769
732
  expect(@return.query).to be_valid
770
733
  end
771
734
  end
@@ -786,7 +749,6 @@ shared_examples 'Finder Interface' do
786
749
  end
787
750
 
788
751
  it 'should have a valid query', :dm do
789
- skip "undefined method `valid?' for #<String"
790
752
  expect(@return.query).to be_valid
791
753
  end
792
754
  end
@@ -811,7 +773,6 @@ shared_examples 'Finder Interface' do
811
773
  end
812
774
 
813
775
  it 'should have a valid query', :dm do
814
- skip "undefined method `valid?' for #<String"
815
776
  expect(@return.query).to be_valid
816
777
  end
817
778
  end
@@ -850,7 +811,6 @@ shared_examples 'Finder Interface' do
850
811
  end
851
812
 
852
813
  it 'should have a valid query', :dm do
853
- skip "undefined method `valid?' for #<String"
854
814
  expect(@return.query).to be_valid
855
815
  end
856
816
 
@@ -875,7 +835,6 @@ shared_examples 'Finder Interface' do
875
835
  end
876
836
 
877
837
  it 'should have a valid query', :dm do
878
- skip "undefined method `valid?' for #<String"
879
838
  expect(@return.query).to be_valid
880
839
  end
881
840
 
@@ -936,7 +895,7 @@ shared_examples 'Finder Interface' do
936
895
  @copy.to_a
937
896
  end
938
897
 
939
- it { is_expected.to equal(@articles.to_a) }
898
+ it { is_expected.to equal(@articles) }
940
899
 
941
900
  it { expect(method(:subject)).to change { yields.dup }.from([]).to(@copy.to_a) }
942
901
  end
@@ -944,9 +903,6 @@ shared_examples 'Finder Interface' do
944
903
  it { expect(@articles).to respond_to(:fetch) }
945
904
 
946
905
  describe '#fetch' do
947
- before do
948
- skip "Who uses fetch anyway..."
949
- end
950
906
  subject { @articles.fetch(*args, &block) }
951
907
 
952
908
  let(:block) { nil }
@@ -998,7 +954,6 @@ shared_examples 'Finder Interface' do
998
954
 
999
955
  describe 'with a belongs_to relationship method' do
1000
956
  before do
1001
- skip "rspec doens't know what rescue_if means.."
1002
957
  rescue_if 'Model#method_missing should delegate to relationships', @articles.kind_of?(Class) do
1003
958
  @articles.create(:body => 'Another Article', :original => @original)
1004
959
 
@@ -1033,7 +988,6 @@ shared_examples 'Finder Interface' do
1033
988
 
1034
989
  describe 'with no arguments' do
1035
990
  before do
1036
- skip "query chains not supported"
1037
991
  @return = @articles.previous
1038
992
  end
1039
993
 
@@ -1053,7 +1007,6 @@ shared_examples 'Finder Interface' do
1053
1007
 
1054
1008
  describe 'with arguments' do
1055
1009
  before do
1056
- skip "query chain not supported"
1057
1010
  @return = @articles.previous(:fields => [ :id ])
1058
1011
  end
1059
1012
 
@@ -1093,7 +1046,6 @@ shared_examples 'Finder Interface' do
1093
1046
 
1094
1047
  describe 'with no arguments' do
1095
1048
  before do
1096
- skip "query chain not supported"
1097
1049
  @return = @collection = @articles.revisions
1098
1050
  end
1099
1051
 
@@ -1112,7 +1064,6 @@ shared_examples 'Finder Interface' do
1112
1064
 
1113
1065
  describe 'with arguments' do
1114
1066
  before do
1115
- skip "query chain not supported"
1116
1067
  @return = @collection = @articles.revisions(:fields => [ :id ])
1117
1068
  end
1118
1069
 
@@ -1168,7 +1119,6 @@ shared_examples 'Finder Interface' do
1168
1119
 
1169
1120
  describe 'with arguments' do
1170
1121
  before do
1171
- skip "query chain not supported"
1172
1122
  @return = @collection = @articles.publications(:fields => [ :id ])
1173
1123
  end
1174
1124
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ardm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.ar427
5
- prerelease: 6
4
+ version: 0.4.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Martin Emde
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-06-19 00:00:00.000000000 Z
13
+ date: 2015-03-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -377,9 +377,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
377
377
  required_rubygems_version: !ruby/object:Gem::Requirement
378
378
  none: false
379
379
  requirements:
380
- - - ! '>'
380
+ - - ! '>='
381
381
  - !ruby/object:Gem::Version
382
- version: 1.3.1
382
+ version: '0'
383
383
  requirements: []
384
384
  rubyforge_project:
385
385
  rubygems_version: 1.8.23.2
@@ -387,4 +387,3 @@ signing_key:
387
387
  specification_version: 3
388
388
  summary: ActiveRecord plugin to provide a smooth migration from DataMapper to ActiveRecord
389
389
  test_files: []
390
- has_rdoc: