dm-types 1.1.0 → 1.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ try_spec do
13
13
  describe '#valid?' do
14
14
  before :all do
15
15
  @string = '{ "foo": "bar" }'
16
- @json = JSON.load(@string)
16
+ @json = MultiJson.decode(@string)
17
17
  end
18
18
 
19
19
  describe "with a String" do
@@ -36,7 +36,7 @@ try_spec do
36
36
 
37
37
  describe 'when Json encoded primitive string is provided' do
38
38
  it 'returns decoded value as Ruby string' do
39
- @property.load(JSON.dump(:value => 'JSON encoded string')).should == { 'value' => 'JSON encoded string' }
39
+ @property.load(MultiJson.encode(:value => 'JSON encoded string')).should == { 'value' => 'JSON encoded string' }
40
40
  end
41
41
  end
42
42
 
@@ -3,8 +3,9 @@ require 'spec_helper'
3
3
  describe DataMapper::Property::ParanoidBoolean do
4
4
  before :all do
5
5
  Object.send(:remove_const, :Blog) if defined?(Blog)
6
+
6
7
  module ::Blog
7
- class Article
8
+ class Draft
8
9
  include DataMapper::Resource
9
10
 
10
11
  property :id, Serial
@@ -14,6 +15,10 @@ describe DataMapper::Property::ParanoidBoolean do
14
15
 
15
16
  def before_destroy; end
16
17
  end
18
+
19
+ class Article < Draft; end
20
+
21
+ class Review < Article; end
17
22
  end
18
23
 
19
24
  @model = Blog::Article
@@ -134,5 +139,12 @@ describe DataMapper::Property::ParanoidBoolean do
134
139
  end
135
140
  end
136
141
  end
142
+
143
+ describe 'Model.inherited' do
144
+ it 'sets @paranoid_properties' do
145
+ ::Blog::Review.instance_variable_get(:@paranoid_properties).should ==
146
+ ::Blog::Article.instance_variable_get(:@paranoid_properties)
147
+ end
148
+ end
137
149
  end
138
150
  end
@@ -4,7 +4,7 @@ describe DataMapper::Property::ParanoidDateTime do
4
4
  before :all do
5
5
  Object.send(:remove_const, :Blog) if defined?(Blog)
6
6
  module ::Blog
7
- class Article
7
+ class Draft
8
8
  include DataMapper::Resource
9
9
 
10
10
  property :id, Serial
@@ -14,6 +14,10 @@ describe DataMapper::Property::ParanoidDateTime do
14
14
 
15
15
  def before_destroy; end
16
16
  end
17
+
18
+ class Article < Draft; end
19
+
20
+ class Review < Article; end
17
21
  end
18
22
 
19
23
  @model = Blog::Article
@@ -139,5 +143,12 @@ describe DataMapper::Property::ParanoidDateTime do
139
143
  end
140
144
  end
141
145
  end
146
+
147
+ describe 'Model.inherited' do
148
+ it 'sets @paranoid_properties' do
149
+ ::Blog::Review.instance_variable_get(:@paranoid_properties).should ==
150
+ ::Blog::Article.instance_variable_get(:@paranoid_properties)
151
+ end
152
+ end
142
153
  end
143
154
  end
@@ -41,25 +41,25 @@ try_spec do
41
41
 
42
42
  describe 'when YAML encoded primitive string is provided' do
43
43
  it 'does not do double encoding' do
44
- @property.dump("--- yaml encoded string\n").should == "--- yaml encoded string\n"
44
+ YAML.load(@property.dump("--- yaml encoded string\n")).should == 'yaml encoded string'
45
45
  end
46
46
  end
47
47
 
48
48
  describe 'when regular Ruby string is provided' do
49
49
  it 'dumps argument to YAML' do
50
- @property.dump('dump me (to yaml)').should == "--- dump me (to yaml)\n"
50
+ YAML.load(@property.dump('dump me (to yaml)')).should == 'dump me (to yaml)'
51
51
  end
52
52
  end
53
53
 
54
54
  describe 'when Ruby array is provided' do
55
55
  it 'dumps argument to YAML' do
56
- @property.dump([1, 2, 3]).should == "--- \n- 1\n- 2\n- 3\n"
56
+ YAML.load(@property.dump([ 1, 2, 3 ])).should == [ 1, 2, 3 ]
57
57
  end
58
58
  end
59
59
 
60
60
  describe 'when Ruby hash is provided' do
61
61
  it 'dumps argument to YAML' do
62
- @property.dump({ :datamapper => 'Data access layer in Ruby' }).should == "--- \n:datamapper: Data access layer in Ruby\n"
62
+ YAML.load(@property.dump({ :datamapper => 'Data access layer in Ruby' })).should == { :datamapper => 'Data access layer in Ruby' }
63
63
  end
64
64
  end
65
65
  end
metadata CHANGED
@@ -1,8 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-types
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.1.0
4
+ hash: 15424023
5
+ prerelease: 6
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 0
10
+ - rc
11
+ - 1
12
+ version: 1.2.0.rc1
6
13
  platform: ruby
7
14
  authors:
8
15
  - Dan Kubb
@@ -10,119 +17,188 @@ autorequire:
10
17
  bindir: bin
11
18
  cert_chain: []
12
19
 
13
- date: 2011-03-16 00:00:00 -07:00
14
- default_executable:
20
+ date: 2011-09-09 00:00:00 Z
15
21
  dependencies:
16
22
  - !ruby/object:Gem::Dependency
17
- name: bcrypt-ruby
18
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ type: :runtime
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
19
25
  none: false
20
26
  requirements:
21
27
  - - ~>
22
28
  - !ruby/object:Gem::Version
23
- version: 2.1.4
24
- type: :runtime
29
+ hash: 7
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
34
+ version: 3.0.0
25
35
  prerelease: false
26
- version_requirements: *id001
36
+ requirement: *id001
37
+ name: bcrypt-ruby
27
38
  - !ruby/object:Gem::Dependency
28
- name: dm-core
29
- requirement: &id002 !ruby/object:Gem::Requirement
39
+ type: :runtime
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
30
41
  none: false
31
42
  requirements:
32
43
  - - ~>
33
44
  - !ruby/object:Gem::Version
34
- version: 1.1.0
35
- type: :runtime
45
+ hash: 15424023
46
+ segments:
47
+ - 1
48
+ - 2
49
+ - 0
50
+ - rc
51
+ - 1
52
+ version: 1.2.0.rc1
36
53
  prerelease: false
37
- version_requirements: *id002
54
+ requirement: *id002
55
+ name: dm-core
38
56
  - !ruby/object:Gem::Dependency
39
- name: fastercsv
40
- requirement: &id003 !ruby/object:Gem::Requirement
57
+ type: :runtime
58
+ version_requirements: &id003 !ruby/object:Gem::Requirement
41
59
  none: false
42
60
  requirements:
43
61
  - - ~>
44
62
  - !ruby/object:Gem::Version
63
+ hash: 11
64
+ segments:
65
+ - 1
66
+ - 5
67
+ - 4
45
68
  version: 1.5.4
46
- type: :runtime
47
69
  prerelease: false
48
- version_requirements: *id003
70
+ requirement: *id003
71
+ name: fastercsv
49
72
  - !ruby/object:Gem::Dependency
50
- name: json
51
- requirement: &id004 !ruby/object:Gem::Requirement
73
+ type: :runtime
74
+ version_requirements: &id004 !ruby/object:Gem::Requirement
52
75
  none: false
53
76
  requirements:
54
77
  - - ~>
55
78
  - !ruby/object:Gem::Version
56
- version: 1.4.6
57
- type: :runtime
79
+ hash: 17
80
+ segments:
81
+ - 1
82
+ - 0
83
+ - 3
84
+ version: 1.0.3
58
85
  prerelease: false
59
- version_requirements: *id004
86
+ requirement: *id004
87
+ name: multi_json
60
88
  - !ruby/object:Gem::Dependency
61
- name: stringex
62
- requirement: &id005 !ruby/object:Gem::Requirement
89
+ type: :runtime
90
+ version_requirements: &id005 !ruby/object:Gem::Requirement
63
91
  none: false
64
92
  requirements:
65
93
  - - ~>
66
94
  - !ruby/object:Gem::Version
67
- version: 1.2.0
95
+ hash: 11
96
+ segments:
97
+ - 1
98
+ - 5
99
+ - 4
100
+ version: 1.5.4
101
+ prerelease: false
102
+ requirement: *id005
103
+ name: json
104
+ - !ruby/object:Gem::Dependency
68
105
  type: :runtime
106
+ version_requirements: &id006 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ hash: 27
112
+ segments:
113
+ - 1
114
+ - 3
115
+ - 0
116
+ version: 1.3.0
69
117
  prerelease: false
70
- version_requirements: *id005
118
+ requirement: *id006
119
+ name: stringex
71
120
  - !ruby/object:Gem::Dependency
72
- name: uuidtools
73
- requirement: &id006 !ruby/object:Gem::Requirement
121
+ type: :runtime
122
+ version_requirements: &id007 !ruby/object:Gem::Requirement
74
123
  none: false
75
124
  requirements:
76
125
  - - ~>
77
126
  - !ruby/object:Gem::Version
127
+ hash: 15
128
+ segments:
129
+ - 2
130
+ - 1
131
+ - 2
78
132
  version: 2.1.2
79
- type: :runtime
80
133
  prerelease: false
81
- version_requirements: *id006
134
+ requirement: *id007
135
+ name: uuidtools
82
136
  - !ruby/object:Gem::Dependency
83
- name: dm-validations
84
- requirement: &id007 !ruby/object:Gem::Requirement
137
+ type: :development
138
+ version_requirements: &id008 !ruby/object:Gem::Requirement
85
139
  none: false
86
140
  requirements:
87
141
  - - ~>
88
142
  - !ruby/object:Gem::Version
89
- version: 1.1.0
90
- type: :development
143
+ hash: 15424023
144
+ segments:
145
+ - 1
146
+ - 2
147
+ - 0
148
+ - rc
149
+ - 1
150
+ version: 1.2.0.rc1
91
151
  prerelease: false
92
- version_requirements: *id007
152
+ requirement: *id008
153
+ name: dm-validations
93
154
  - !ruby/object:Gem::Dependency
94
- name: jeweler
95
- requirement: &id008 !ruby/object:Gem::Requirement
155
+ type: :development
156
+ version_requirements: &id009 !ruby/object:Gem::Requirement
96
157
  none: false
97
158
  requirements:
98
159
  - - ~>
99
160
  - !ruby/object:Gem::Version
100
- version: 1.5.2
101
- type: :development
161
+ hash: 7
162
+ segments:
163
+ - 1
164
+ - 6
165
+ - 4
166
+ version: 1.6.4
102
167
  prerelease: false
103
- version_requirements: *id008
168
+ requirement: *id009
169
+ name: jeweler
104
170
  - !ruby/object:Gem::Dependency
105
- name: rake
106
- requirement: &id009 !ruby/object:Gem::Requirement
171
+ type: :development
172
+ version_requirements: &id010 !ruby/object:Gem::Requirement
107
173
  none: false
108
174
  requirements:
109
175
  - - ~>
110
176
  - !ruby/object:Gem::Version
111
- version: 0.8.7
112
- type: :development
177
+ hash: 63
178
+ segments:
179
+ - 0
180
+ - 9
181
+ - 2
182
+ version: 0.9.2
113
183
  prerelease: false
114
- version_requirements: *id009
184
+ requirement: *id010
185
+ name: rake
115
186
  - !ruby/object:Gem::Dependency
116
- name: rspec
117
- requirement: &id010 !ruby/object:Gem::Requirement
187
+ type: :development
188
+ version_requirements: &id011 !ruby/object:Gem::Requirement
118
189
  none: false
119
190
  requirements:
120
191
  - - ~>
121
192
  - !ruby/object:Gem::Version
122
- version: 1.3.1
123
- type: :development
193
+ hash: 31
194
+ segments:
195
+ - 1
196
+ - 3
197
+ - 2
198
+ version: 1.3.2
124
199
  prerelease: false
125
- version_requirements: *id010
200
+ requirement: *id011
201
+ name: rspec
126
202
  description: DataMapper plugin providing extra data types
127
203
  email: dan.kubb [a] gmail [d] com
128
204
  executables: []
@@ -140,6 +216,7 @@ files:
140
216
  - VERSION
141
217
  - dm-types.gemspec
142
218
  - lib/dm-types.rb
219
+ - lib/dm-types/api_key.rb
143
220
  - lib/dm-types/bcrypt_hash.rb
144
221
  - lib/dm-types/comma_separated_list.rb
145
222
  - lib/dm-types/csv.rb
@@ -154,10 +231,12 @@ files:
154
231
  - lib/dm-types/paranoid_datetime.rb
155
232
  - lib/dm-types/regexp.rb
156
233
  - lib/dm-types/slug.rb
234
+ - lib/dm-types/support/dirty_minder.rb
157
235
  - lib/dm-types/support/flags.rb
158
236
  - lib/dm-types/uri.rb
159
237
  - lib/dm-types/uuid.rb
160
238
  - lib/dm-types/yaml.rb
239
+ - spec/fixtures/api_user.rb
161
240
  - spec/fixtures/article.rb
162
241
  - spec/fixtures/bookmark.rb
163
242
  - spec/fixtures/invention.rb
@@ -166,9 +245,12 @@ files:
166
245
  - spec/fixtures/software_package.rb
167
246
  - spec/fixtures/ticket.rb
168
247
  - spec/fixtures/tshirt.rb
248
+ - spec/integration/api_key_spec.rb
169
249
  - spec/integration/bcrypt_hash_spec.rb
170
250
  - spec/integration/comma_separated_list_spec.rb
251
+ - spec/integration/dirty_minder_spec.rb
171
252
  - spec/integration/enum_spec.rb
253
+ - spec/integration/epoch_time_spec.rb
172
254
  - spec/integration/file_path_spec.rb
173
255
  - spec/integration/flag_spec.rb
174
256
  - spec/integration/ip_address_spec.rb
@@ -199,7 +281,6 @@ files:
199
281
  - tasks/spec.rake
200
282
  - tasks/yard.rake
201
283
  - tasks/yardstick.rake
202
- has_rdoc: true
203
284
  homepage: http://github.com/datamapper/dm-types
204
285
  licenses: []
205
286
 
@@ -213,54 +294,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
294
  requirements:
214
295
  - - ">="
215
296
  - !ruby/object:Gem::Version
297
+ hash: 3
298
+ segments:
299
+ - 0
216
300
  version: "0"
217
301
  required_rubygems_version: !ruby/object:Gem::Requirement
218
302
  none: false
219
303
  requirements:
220
- - - ">="
304
+ - - ">"
221
305
  - !ruby/object:Gem::Version
222
- version: "0"
306
+ hash: 25
307
+ segments:
308
+ - 1
309
+ - 3
310
+ - 1
311
+ version: 1.3.1
223
312
  requirements: []
224
313
 
225
314
  rubyforge_project: datamapper
226
- rubygems_version: 1.6.2
315
+ rubygems_version: 1.8.10
227
316
  signing_key:
228
317
  specification_version: 3
229
318
  summary: DataMapper plugin providing extra data types
230
- test_files:
231
- - spec/fixtures/article.rb
232
- - spec/fixtures/bookmark.rb
233
- - spec/fixtures/invention.rb
234
- - spec/fixtures/network_node.rb
235
- - spec/fixtures/person.rb
236
- - spec/fixtures/software_package.rb
237
- - spec/fixtures/ticket.rb
238
- - spec/fixtures/tshirt.rb
239
- - spec/integration/bcrypt_hash_spec.rb
240
- - spec/integration/comma_separated_list_spec.rb
241
- - spec/integration/enum_spec.rb
242
- - spec/integration/file_path_spec.rb
243
- - spec/integration/flag_spec.rb
244
- - spec/integration/ip_address_spec.rb
245
- - spec/integration/json_spec.rb
246
- - spec/integration/slug_spec.rb
247
- - spec/integration/uri_spec.rb
248
- - spec/integration/uuid_spec.rb
249
- - spec/integration/yaml_spec.rb
250
- - spec/shared/flags_shared_spec.rb
251
- - spec/shared/identity_function_group.rb
252
- - spec/spec_helper.rb
253
- - spec/unit/bcrypt_hash_spec.rb
254
- - spec/unit/csv_spec.rb
255
- - spec/unit/enum_spec.rb
256
- - spec/unit/epoch_time_spec.rb
257
- - spec/unit/file_path_spec.rb
258
- - spec/unit/flag_spec.rb
259
- - spec/unit/ip_address_spec.rb
260
- - spec/unit/json_spec.rb
261
- - spec/unit/paranoid_boolean_spec.rb
262
- - spec/unit/paranoid_datetime_spec.rb
263
- - spec/unit/regexp_spec.rb
264
- - spec/unit/uri_spec.rb
265
- - spec/unit/uuid_spec.rb
266
- - spec/unit/yaml_spec.rb
319
+ test_files: []
320
+