sixarm_ruby_active_record_mock 1.4.4 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,6 @@
1
1
  CHANGELOG
2
2
 
3
+ 2011-05-01 1.4.6 Add find_by_id
3
4
  2011-04-25 1.4.4 Add find by nil
4
5
  2011-04-19 1.4.2 Add <attribute>_before_type_cast
5
6
  2011-04-19 1.4.0 Add attributes via method_missing
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.4
1
+ 1.4.6
@@ -20,7 +20,7 @@ class ActiveRecordMock
20
20
  @attributes[k]=v
21
21
  end
22
22
 
23
- def self.find(id,*ops)
23
+ def self.find(id,ops={})
24
24
  case id
25
25
  when nil
26
26
  raise ArgumentError.new
@@ -32,6 +32,15 @@ class ActiveRecordMock
32
32
  end
33
33
  end
34
34
 
35
+ def self.find_by_id(id,ops={})
36
+ case id
37
+ when nil
38
+ nil
39
+ else
40
+ self.find(id,ops)
41
+ end
42
+ end
43
+
35
44
  def self.find=(records)
36
45
  @@find=records
37
46
  end
@@ -79,13 +79,24 @@ class Testing < Test::Unit::TestCase
79
79
  x = ActiveRecordMock.find(:all)
80
80
  assert_equal(x,all,"find :all x:#{x}")
81
81
 
82
- # Retrieve by id
82
+ # Retrieve via #find
83
83
  x = ActiveRecordMock.find(1); assert_equal(x,anne,"find(1) x:#{x},anne")
84
84
  x = ActiveRecordMock.find(2); assert_equal(x,beth,"find(2) x:#{x},beth")
85
85
  x = ActiveRecordMock.find(3); assert_equal(x,cate,"find(3) x:#{x},cate")
86
86
 
87
- # Retrieve by nil
88
- x = ActiveRecordMock.find(nil); assert_nil(x,"find(nil) should be nil")
89
- end
87
+ # Retrieve via #find_by_id
88
+ x = ActiveRecordMock.find_by_id(1); assert_equal(x,anne,"find(1) x:#{x},anne")
89
+ x = ActiveRecordMock.find_by_id(2); assert_equal(x,beth,"find(2) x:#{x},beth")
90
+ x = ActiveRecordMock.find_by_id(3); assert_equal(x,cate,"find(3) x:#{x},cate")
91
+
92
+ # Retrieve by #find(nil) => ArgumentError
93
+ assert_raise(ArgumentError) do
94
+ x = ActiveRecordMock.find(nil);
95
+ end
90
96
 
97
+ # Retrieve by #find_by_id(nil) => nil
98
+ x = ActiveRecordMock.find_by_id(nil); assert_nil(x,"find(nil) should be nil")
99
+
100
+ end
101
+
91
102
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sixarm_ruby_active_record_mock
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.4
5
+ version: 1.4.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - SixArm
@@ -30,7 +30,7 @@ cert_chain:
30
30
  eabwpCbAopo=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2011-04-26 00:00:00 -07:00
33
+ date: 2011-05-01 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies: []
36
36
 
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- V���Jbt�ޠx���Ӡ9�p;�0�`�ȧ�+A��+���#����=-�eVzo���V2ug'8 ��C��|��vF�4�m��1EO5��Dy5��,�N�a��� i��2�i�gg�
1
+ �ȝ�T�u�Ԍ������kr(6�qgo-��ɏp�hbJcaoG��!�d{�*ERaE�(���-�4@�C%�IQ�M��+cd0��x
2
+ 6�����o;^�^��Q�.k�?