dm-validations 1.0.0.rc3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -71,7 +71,7 @@
71
71
  source 'http://rubygems.org'
72
72
 
73
73
  DATAMAPPER = 'git://github.com/datamapper'
74
- DM_VERSION = '~> 1.0.0.rc3'
74
+ DM_VERSION = '~> 1.0.0'
75
75
 
76
76
  group :runtime do # Runtime dependencies (as in the gemspec)
77
77
 
data/Rakefile CHANGED
@@ -15,10 +15,10 @@ begin
15
15
 
16
16
  gem.rubyforge_project = 'datamapper'
17
17
 
18
- gem.add_dependency 'dm-core', '~> 1.0.0.rc3'
18
+ gem.add_dependency 'dm-core', '~> 1.0.0'
19
19
 
20
20
  gem.add_development_dependency 'rspec', '~> 1.3'
21
- gem.add_development_dependency 'dm-types', '~> 1.0.0.rc3'
21
+ gem.add_development_dependency 'dm-types', '~> 1.0.0'
22
22
  end
23
23
 
24
24
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.rc3
1
+ 1.0.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dm-validations}
8
- s.version = "1.0.0.rc3"
8
+ s.version = "1.0.0"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Guy van den Berg"]
12
- s.date = %q{2010-05-27}
12
+ s.date = %q{2010-06-08}
13
13
  s.description = %q{Library for performing validations on DM models and pure Ruby object}
14
14
  s.email = %q{vandenberg.guy [a] gmail [d] com}
15
15
  s.extra_rdoc_files = [
@@ -56,7 +56,6 @@ Gem::Specification.new do |s|
56
56
  "spec/fixtures/company.rb",
57
57
  "spec/fixtures/corporate_world.rb",
58
58
  "spec/fixtures/country.rb",
59
- "spec/fixtures/currency.rb",
60
59
  "spec/fixtures/ethernet_frame.rb",
61
60
  "spec/fixtures/event.rb",
62
61
  "spec/fixtures/g3_concert.rb",
@@ -67,6 +66,7 @@ Gem::Specification.new do |s|
67
66
  "spec/fixtures/memory_object.rb",
68
67
  "spec/fixtures/mittelschnauzer.rb",
69
68
  "spec/fixtures/motor_launch.rb",
69
+ "spec/fixtures/multibyte.rb",
70
70
  "spec/fixtures/page.rb",
71
71
  "spec/fixtures/phone_number.rb",
72
72
  "spec/fixtures/pirogue.rb",
@@ -180,7 +180,6 @@ Gem::Specification.new do |s|
180
180
  "spec/fixtures/company.rb",
181
181
  "spec/fixtures/corporate_world.rb",
182
182
  "spec/fixtures/country.rb",
183
- "spec/fixtures/currency.rb",
184
183
  "spec/fixtures/ethernet_frame.rb",
185
184
  "spec/fixtures/event.rb",
186
185
  "spec/fixtures/g3_concert.rb",
@@ -191,6 +190,7 @@ Gem::Specification.new do |s|
191
190
  "spec/fixtures/memory_object.rb",
192
191
  "spec/fixtures/mittelschnauzer.rb",
193
192
  "spec/fixtures/motor_launch.rb",
193
+ "spec/fixtures/multibyte.rb",
194
194
  "spec/fixtures/page.rb",
195
195
  "spec/fixtures/phone_number.rb",
196
196
  "spec/fixtures/pirogue.rb",
@@ -285,18 +285,18 @@ Gem::Specification.new do |s|
285
285
  s.specification_version = 3
286
286
 
287
287
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
288
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
288
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0"])
289
289
  s.add_development_dependency(%q<rspec>, ["~> 1.3"])
290
- s.add_development_dependency(%q<dm-types>, ["~> 1.0.0.rc3"])
290
+ s.add_development_dependency(%q<dm-types>, ["~> 1.0.0"])
291
291
  else
292
- s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
292
+ s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
293
293
  s.add_dependency(%q<rspec>, ["~> 1.3"])
294
- s.add_dependency(%q<dm-types>, ["~> 1.0.0.rc3"])
294
+ s.add_dependency(%q<dm-types>, ["~> 1.0.0"])
295
295
  end
296
296
  else
297
- s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc3"])
297
+ s.add_dependency(%q<dm-core>, ["~> 1.0.0"])
298
298
  s.add_dependency(%q<rspec>, ["~> 1.3"])
299
- s.add_dependency(%q<dm-types>, ["~> 1.0.0.rc3"])
299
+ s.add_dependency(%q<dm-types>, ["~> 1.0.0"])
300
300
  end
301
301
  end
302
302
 
@@ -94,7 +94,7 @@ module DataMapper
94
94
  #
95
95
  # @api private
96
96
  def value_length(value)
97
- value.to_str.split(//).size
97
+ value.to_str.split(//u).size
98
98
  end
99
99
 
100
100
  # Validate the value length is equal to the expected length
@@ -0,0 +1,16 @@
1
+ # coding: utf-8
2
+
3
+ module DataMapper
4
+ module Validations
5
+ module Fixtures
6
+ class Multibyte
7
+ include DataMapper::Resource
8
+
9
+ property :id, Serial
10
+ property :name, String
11
+
12
+ validates_length_of :name, :is => 20
13
+ end
14
+ end
15
+ end
16
+ end
@@ -68,12 +68,18 @@ describe 'DataMapper::Validations::Fixtures::EthernetFrame' do
68
68
 
69
69
  describe "with multibyte characters" do
70
70
  before :all do
71
- @model = DataMapper::Validations::Fixtures::Currency.valid_instance(
72
- :name => 'Euro',
73
- :code => 'EUR',
74
- :symbol => '€'
75
- )
76
- @model.valid?
71
+ begin
72
+ # force normal encoding in this block
73
+ original, $KCODE = $KCODE, 'N' if RUBY_VERSION <= '1.8.6'
74
+
75
+ # example from: http://intertwingly.net/stories/2004/04/14/i18n.html
76
+ @model = DataMapper::Validations::Fixtures::Multibyte.new(
77
+ :name => 'Iñtërnâtiônàlizætiøn'
78
+ )
79
+ @model.should be_valid
80
+ ensure
81
+ $KCODE = original if RUBY_VERSION <= '1.8.6'
82
+ end
77
83
  end
78
84
 
79
85
  it_should_behave_like "valid model"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-validations
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940572
5
- prerelease: true
4
+ hash: 23
5
+ prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - rc3
11
- version: 1.0.0.rc3
10
+ version: 1.0.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Guy van den Berg
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-05-27 00:00:00 -07:00
18
+ date: 2010-06-08 00:00:00 -07:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -27,13 +26,12 @@ dependencies:
27
26
  requirements:
28
27
  - - ~>
29
28
  - !ruby/object:Gem::Version
30
- hash: 977940572
29
+ hash: 23
31
30
  segments:
32
31
  - 1
33
32
  - 0
34
33
  - 0
35
- - rc3
36
- version: 1.0.0.rc3
34
+ version: 1.0.0
37
35
  type: :runtime
38
36
  version_requirements: *id001
39
37
  - !ruby/object:Gem::Dependency
@@ -59,13 +57,12 @@ dependencies:
59
57
  requirements:
60
58
  - - ~>
61
59
  - !ruby/object:Gem::Version
62
- hash: 977940572
60
+ hash: 23
63
61
  segments:
64
62
  - 1
65
63
  - 0
66
64
  - 0
67
- - rc3
68
- version: 1.0.0.rc3
65
+ version: 1.0.0
69
66
  type: :development
70
67
  version_requirements: *id003
71
68
  description: Library for performing validations on DM models and pure Ruby object
@@ -117,7 +114,6 @@ files:
117
114
  - spec/fixtures/company.rb
118
115
  - spec/fixtures/corporate_world.rb
119
116
  - spec/fixtures/country.rb
120
- - spec/fixtures/currency.rb
121
117
  - spec/fixtures/ethernet_frame.rb
122
118
  - spec/fixtures/event.rb
123
119
  - spec/fixtures/g3_concert.rb
@@ -128,6 +124,7 @@ files:
128
124
  - spec/fixtures/memory_object.rb
129
125
  - spec/fixtures/mittelschnauzer.rb
130
126
  - spec/fixtures/motor_launch.rb
127
+ - spec/fixtures/multibyte.rb
131
128
  - spec/fixtures/page.rb
132
129
  - spec/fixtures/phone_number.rb
133
130
  - spec/fixtures/pirogue.rb
@@ -244,14 +241,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
244
241
  required_rubygems_version: !ruby/object:Gem::Requirement
245
242
  none: false
246
243
  requirements:
247
- - - ">"
244
+ - - ">="
248
245
  - !ruby/object:Gem::Version
249
- hash: 25
246
+ hash: 3
250
247
  segments:
251
- - 1
252
- - 3
253
- - 1
254
- version: 1.3.1
248
+ - 0
249
+ version: "0"
255
250
  requirements: []
256
251
 
257
252
  rubyforge_project: datamapper
@@ -270,7 +265,6 @@ test_files:
270
265
  - spec/fixtures/company.rb
271
266
  - spec/fixtures/corporate_world.rb
272
267
  - spec/fixtures/country.rb
273
- - spec/fixtures/currency.rb
274
268
  - spec/fixtures/ethernet_frame.rb
275
269
  - spec/fixtures/event.rb
276
270
  - spec/fixtures/g3_concert.rb
@@ -281,6 +275,7 @@ test_files:
281
275
  - spec/fixtures/memory_object.rb
282
276
  - spec/fixtures/mittelschnauzer.rb
283
277
  - spec/fixtures/motor_launch.rb
278
+ - spec/fixtures/multibyte.rb
284
279
  - spec/fixtures/page.rb
285
280
  - spec/fixtures/phone_number.rb
286
281
  - spec/fixtures/pirogue.rb
@@ -1,42 +0,0 @@
1
- module DataMapper
2
- module Validations
3
- module Fixtures
4
- class Currency
5
-
6
- #
7
- # Behaviors
8
- #
9
-
10
- include DataMapper::Resource
11
-
12
- #
13
- # Properties
14
- #
15
-
16
- without_auto_validations do
17
- property :name, String, :length => 1..50, :key => true
18
- property :code, String, :length => 3, :unique_index => true
19
- property :symbol, String, :length => 1
20
- end
21
-
22
- #
23
- # Validations
24
- #
25
-
26
- validates_length_of :name, :within => 1..50
27
- validates_length_of :code, :is => 3
28
- validates_length_of :symbol, :is => 1
29
-
30
- def self.valid_instance(overrides = {})
31
- defaults = {
32
- :name => 'United States Dollar',
33
- :code => 'USD',
34
- :symbol => '$'
35
- }
36
-
37
- new(defaults.merge(overrides))
38
- end
39
- end # Barcode
40
- end
41
- end
42
- end