data_validator 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,6 +45,7 @@ module DataValidator
45
45
  end
46
46
  end
47
47
 
48
+ I18n.load_path += Dir[File.join(File.dirname(__FILE__), '..', 'locale', '*.{rb,yml}')]
48
49
  Dir[File.dirname(__FILE__) + "/validations/*.rb"].sort.each do |path|
49
50
  filename = File.basename(path)
50
51
  require "validations/#{filename}"
@@ -1,3 +1,3 @@
1
1
  module DataValidator
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -38,9 +38,9 @@ module DataValidator
38
38
  end
39
39
 
40
40
  if errors.key? name
41
- errors[name] << "#{error_subject} #{I18n.t("errors.messages.#{error_message_key.to_s}", message_args)}"
41
+ errors[name] << "#{error_subject} #{I18n.t("datavalidator.errors.messages.#{error_message_key.to_s}", message_args)}"
42
42
  else
43
- errors[name] = ["#{error_subject} #{I18n.t("errors.messages.#{error_message_key.to_s}", message_args)}"]
43
+ errors[name] = ["#{error_subject} #{I18n.t("datavalidator.errors.messages.#{error_message_key.to_s}", message_args)}"]
44
44
  end
45
45
  end
46
46
  end
@@ -0,0 +1,25 @@
1
+ en:
2
+ datavalidator:
3
+ errors:
4
+ messages:
5
+ inclusion: "is not included in the list"
6
+ exclusion: "is reserved"
7
+ invalid: "is invalid"
8
+ confirmation: "doesn't match confirmation"
9
+ accepted: "must be accepted"
10
+ empty: "can't be empty"
11
+ blank: "can't be blank"
12
+ too_long: "is too long (maximum is %{count} characters)"
13
+ too_short: "is too short (minimum is %{count} characters)"
14
+ wrong_length: "is the wrong length (should be %{count} characters)"
15
+ taken: "has already been taken"
16
+ not_a_number: "is not a number"
17
+ not_an_integer: "is not an integer"
18
+ greater_than: "must be greater than %{count}"
19
+ greater_than_or_equal_to: "must be greater than or equal to %{count}"
20
+ equal_to: "must be equal to %{count}"
21
+ less_than: "must be less than %{count}"
22
+ less_than_or_equal_to: "must be less than or equal to %{count}"
23
+ odd: "must be odd"
24
+ even: "must be even"
25
+
@@ -11,6 +11,4 @@ $TESTING=true
11
11
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
12
12
  require 'data_validator'
13
13
 
14
- I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'locale', '*.{rb,yml}')]
15
-
16
14
 
@@ -14,7 +14,16 @@ describe DataValidator::InclusionValidator do
14
14
  end
15
15
  it { should be_true }
16
16
  end
17
- end
17
+ context 'in' do
18
+ subject do
19
+ DataValidator::Validator.new(
20
+ {name: '0'},
21
+ {name: {inclusion: {in: ['0', '1']}}}
22
+ ).valid?
23
+ end
24
+ it { should be_true }
25
+ end
26
+ end
18
27
 
19
28
  context 'validation false' do
20
29
  before do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-01 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70095235205660 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70095235205660
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: i18n
27
- requirement: &70095235204820 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0.6'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70095235204820
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.6'
36
46
  description: ! ' DataValidator has almost active_recorde validation methods.
37
47
 
38
48
  '
@@ -59,8 +69,8 @@ files:
59
69
  - lib/validations/length.rb
60
70
  - lib/validations/numericality.rb
61
71
  - lib/validations/presence.rb
72
+ - locale/en.yml
62
73
  - spec/data_validator_spec.rb
63
- - spec/locale/en.yml
64
74
  - spec/spec_helper.rb
65
75
  - spec/validations/acceptance_spec.rb
66
76
  - spec/validations/base_spec.rb
@@ -90,13 +100,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
100
  version: '0'
91
101
  requirements: []
92
102
  rubyforge_project: data_validator
93
- rubygems_version: 1.8.11
103
+ rubygems_version: 1.8.23
94
104
  signing_key:
95
105
  specification_version: 3
96
106
  summary: DataValidator is validation anywhere
97
107
  test_files:
98
108
  - spec/data_validator_spec.rb
99
- - spec/locale/en.yml
100
109
  - spec/spec_helper.rb
101
110
  - spec/validations/acceptance_spec.rb
102
111
  - spec/validations/base_spec.rb
@@ -106,4 +115,3 @@ test_files:
106
115
  - spec/validations/length_validation_spec.rb
107
116
  - spec/validations/numericality_spec.rb
108
117
  - spec/validations/presence_validation_spec.rb
109
- has_rdoc:
@@ -1,24 +0,0 @@
1
- en:
2
- errors:
3
- messages:
4
- inclusion: "is not included in the list"
5
- exclusion: "is reserved"
6
- invalid: "is invalid"
7
- confirmation: "doesn't match confirmation"
8
- accepted: "must be accepted"
9
- empty: "can't be empty"
10
- blank: "can't be blank"
11
- too_long: "is too long (maximum is %{count} characters)"
12
- too_short: "is too short (minimum is %{count} characters)"
13
- wrong_length: "is the wrong length (should be %{count} characters)"
14
- taken: "has already been taken"
15
- not_a_number: "is not a number"
16
- not_an_integer: "is not an integer"
17
- greater_than: "must be greater than %{count}"
18
- greater_than_or_equal_to: "must be greater than or equal to %{count}"
19
- equal_to: "must be equal to %{count}"
20
- less_than: "must be less than %{count}"
21
- less_than_or_equal_to: "must be less than or equal to %{count}"
22
- odd: "must be odd"
23
- even: "must be even"
24
-