unidata 0.0.4 → 0.0.5
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/lib/unidata/model.rb +5 -5
- data/lib/unidata/version.rb +1 -1
- data/spec/unidata/model_spec.rb +9 -0
- metadata +2 -2
data/lib/unidata/model.rb
CHANGED
@@ -57,11 +57,11 @@ module Unidata
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def find(id)
|
60
|
-
record = connection.read(filename, id)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
if record = connection.read(filename, id)
|
61
|
+
instance = from_unidata(record)
|
62
|
+
instance.id = id
|
63
|
+
instance
|
64
|
+
end
|
65
65
|
end
|
66
66
|
|
67
67
|
private
|
data/lib/unidata/version.rb
CHANGED
data/spec/unidata/model_spec.rb
CHANGED
@@ -153,6 +153,15 @@ describe Unidata::Model do
|
|
153
153
|
obj.salary.should == BigDecimal.new('60_000.00')
|
154
154
|
obj.status.should == 'INACTIVE'
|
155
155
|
end
|
156
|
+
|
157
|
+
context 'when record does not exist' do
|
158
|
+
it 'returns nil' do
|
159
|
+
@connection.stub(:read).with('TEST', '234').and_return(nil)
|
160
|
+
|
161
|
+
obj = Record.find('234')
|
162
|
+
obj.should be_nil
|
163
|
+
end
|
164
|
+
end
|
156
165
|
end
|
157
166
|
|
158
167
|
describe '#initialize' do
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: unidata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jeremy Israelsen
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|