sixarm_ruby_active_record_mock 1.4.4 → 1.4.6
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.tar.gz.sig +0 -0
- data/CHANGELOG.txt +1 -0
- data/VERSION +1 -1
- data/lib/sixarm_ruby_active_record_mock.rb +10 -1
- data/test/sixarm_ruby_active_record_mock_test.rb +15 -4
- metadata +2 -2
- metadata.gz.sig +2 -1
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.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
|
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
|
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
|
88
|
-
x = ActiveRecordMock.
|
89
|
-
|
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.
|
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-
|
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
|
-
|
1
|
+
�ȝ�T�u�Ԍ������kr(6�qgo-��ɏp�h�b�Jcao�G��!�d{�*E�Ra�E�(���-�4@�C%�IQ�M��+c�d�0��x
|
2
|
+
6�����o;^�^��Q�.k�?
|