remarkable_date_validator 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/README.rdoc +11 -2
- data/Rakefile +14 -7
- data/VERSION +1 -1
- data/lib/remarkable/date_validator.rb +1 -4
- data/locale/en.yml +8 -8
- data/remarkable_date_validator.gemspec +11 -10
- data/spec/remarkable_date_validator_spec.rb +1 -3
- data/spec/spec_helper.rb +9 -14
- metadata +33 -15
data/.rspec
ADDED
data/README.rdoc
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
= remarkable_date_validator
|
2
2
|
|
3
|
-
Remarkable matchers for date_validator! (a date validator for Rails 3: http://github.com/codegram/date_validator/)
|
3
|
+
Remarkable 4 matchers for date_validator! (a date validator for Rails 3: http://github.com/codegram/date_validator/)
|
4
4
|
|
5
5
|
Easy peasy. Add gemcutter sources:
|
6
6
|
|
7
7
|
gem sources -a http://gemcutter.org/
|
8
8
|
|
9
|
+
Make sure you have Remarkable 4 + Remarkable ActiveModel 4 (currently supporting 4.0.0.alpha4):
|
10
|
+
|
11
|
+
gem install remarkable --pre
|
12
|
+
gem install remarkable_activemodel --pre
|
13
|
+
|
9
14
|
Install date_validator if you haven't already:'
|
10
15
|
|
11
16
|
gem install date_validator
|
@@ -14,7 +19,11 @@ Install date_validator if you haven't already:'
|
|
14
19
|
|
15
20
|
gem install remarkable_date_validator
|
16
21
|
|
17
|
-
In your
|
22
|
+
In your spec_helper:
|
23
|
+
|
24
|
+
require 'remarkable/date_validator'
|
25
|
+
|
26
|
+
And last but not least, in your model specs:
|
18
27
|
|
19
28
|
should_validate_date_of :whatever_date, :date => {:before => Time.now + 2.years, :after_or_equal_to => Time.now}
|
20
29
|
|
data/Rakefile
CHANGED
@@ -13,10 +13,10 @@ begin
|
|
13
13
|
|
14
14
|
gem.add_dependency "remarkable", '>=4.0.0.alpha4'
|
15
15
|
gem.add_dependency 'remarkable_activemodel', '>=4.0.0.alpha4'
|
16
|
-
gem.add_dependency 'date_validator', '>=0.
|
16
|
+
gem.add_dependency 'date_validator', '>=0.5.2'
|
17
17
|
gem.add_development_dependency 'active_record', '>=3.0.0.beta4'
|
18
|
-
gem.add_development_dependency 'rspec', '>=2.0.0.beta.11'
|
19
18
|
gem.add_development_dependency 'sqlite3'
|
19
|
+
gem.add_development_dependency 'rspec', '>=2.0.0.beta.12'
|
20
20
|
|
21
21
|
end
|
22
22
|
Jeweler::GemcutterTasks.new
|
@@ -24,11 +24,18 @@ rescue LoadError
|
|
24
24
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
25
25
|
end
|
26
26
|
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
# Rake RSpec2 task stuff
|
28
|
+
gem 'rspec', '>= 2.0.0.beta.12'
|
29
|
+
gem 'rspec-expectations'
|
30
|
+
|
31
|
+
require 'rspec/core/rake_task'
|
32
|
+
|
33
|
+
desc "Run the specs under spec"
|
34
|
+
RSpec::Core::RakeTask.new do |t|
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
task :default => :spec
|
32
39
|
|
33
40
|
require 'rake/rdoctask'
|
34
41
|
Rake::RDocTask.new do |rdoc|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# Load Remarkable
|
2
2
|
require 'remarkable/core'
|
3
3
|
require 'remarkable/active_model'
|
4
|
+
require 'remarkable/date_validator'
|
4
5
|
|
5
6
|
# Add default locale
|
6
7
|
dir = File.dirname(__FILE__)
|
@@ -8,12 +9,8 @@ Dir["#{dir}/../../locale/*yml"].each {|f| Remarkable.add_locale(f) }
|
|
8
9
|
|
9
10
|
# Add matchers
|
10
11
|
Dir[File.join(dir, 'date_validator', 'matchers', '*.rb')].each do |file|
|
11
|
-
puts "Requiring #{file.inspect}"
|
12
12
|
require file
|
13
13
|
end
|
14
|
-
puts "CLASS:"
|
15
|
-
puts Remarkable::ActiveModel::Matchers::ValidateDateOfMatcher.inspect
|
16
|
-
puts "END CLASS"
|
17
14
|
|
18
15
|
|
19
16
|
Remarkable.include_matchers!(Remarkable::ActiveModel, Rspec::Core::ExampleGroup)
|
data/locale/en.yml
CHANGED
@@ -5,17 +5,17 @@ en:
|
|
5
5
|
remarkable:
|
6
6
|
active_model:
|
7
7
|
validate_date_of:
|
8
|
-
description: "ensure date format and limits of {
|
8
|
+
description: "ensure date format and limits of %{attributes}"
|
9
9
|
expectations:
|
10
|
-
only_date_values: "{
|
11
|
-
after_maximum: "{
|
12
|
-
before_minimum: "{
|
10
|
+
only_date_values: "%{subject_name} to allow only date values for %{value}"
|
11
|
+
after_maximum: "%{subject_name} to be invalid when %{attribute} is after %{value}"
|
12
|
+
before_minimum: "%{subject_name} to be invalid when %{attribute} is before %{value}"
|
13
13
|
optionals:
|
14
14
|
before:
|
15
|
-
positive: "is less than {
|
15
|
+
positive: "is less than %{inspect}"
|
16
16
|
after:
|
17
|
-
positive: "is after {
|
17
|
+
positive: "is after %{inspect}"
|
18
18
|
before_or_equal_to:
|
19
|
-
positive: "is before or equal to {
|
19
|
+
positive: "is before or equal to %{inspect}"
|
20
20
|
after_or_equal_to:
|
21
|
-
positive: "is after or equal to {
|
21
|
+
positive: "is after or equal to %{inspect}"
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{remarkable_date_validator}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oriol Gual", "Josep M\302\252 Bach", "Josep Jaume Rey"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-19}
|
13
13
|
s.description = %q{Remarkable matchers for date_validator}
|
14
14
|
s.email = %q{info@codegram.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
".rspec",
|
22
23
|
"LICENSE",
|
23
24
|
"README.rdoc",
|
24
25
|
"Rakefile",
|
@@ -34,7 +35,7 @@ Gem::Specification.new do |s|
|
|
34
35
|
s.homepage = %q{http://github.com/codegram/remarkable_date_validator}
|
35
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
36
37
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = %q{1.3.
|
38
|
+
s.rubygems_version = %q{1.3.7}
|
38
39
|
s.summary = %q{Remarkable matchers for date_validator}
|
39
40
|
s.test_files = [
|
40
41
|
"spec/model_builder.rb",
|
@@ -46,28 +47,28 @@ Gem::Specification.new do |s|
|
|
46
47
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
48
|
s.specification_version = 3
|
48
49
|
|
49
|
-
if Gem::Version.new(Gem::
|
50
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
51
|
s.add_runtime_dependency(%q<remarkable>, [">= 4.0.0.alpha4"])
|
51
52
|
s.add_runtime_dependency(%q<remarkable_activemodel>, [">= 4.0.0.alpha4"])
|
52
|
-
s.add_runtime_dependency(%q<date_validator>, [">= 0.
|
53
|
+
s.add_runtime_dependency(%q<date_validator>, [">= 0.5.2"])
|
53
54
|
s.add_development_dependency(%q<active_record>, [">= 3.0.0.beta4"])
|
54
|
-
s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.11"])
|
55
55
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<rspec>, [">= 2.0.0.beta.12"])
|
56
57
|
else
|
57
58
|
s.add_dependency(%q<remarkable>, [">= 4.0.0.alpha4"])
|
58
59
|
s.add_dependency(%q<remarkable_activemodel>, [">= 4.0.0.alpha4"])
|
59
|
-
s.add_dependency(%q<date_validator>, [">= 0.
|
60
|
+
s.add_dependency(%q<date_validator>, [">= 0.5.2"])
|
60
61
|
s.add_dependency(%q<active_record>, [">= 3.0.0.beta4"])
|
61
|
-
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.11"])
|
62
62
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
63
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.12"])
|
63
64
|
end
|
64
65
|
else
|
65
66
|
s.add_dependency(%q<remarkable>, [">= 4.0.0.alpha4"])
|
66
67
|
s.add_dependency(%q<remarkable_activemodel>, [">= 4.0.0.alpha4"])
|
67
|
-
s.add_dependency(%q<date_validator>, [">= 0.
|
68
|
+
s.add_dependency(%q<date_validator>, [">= 0.5.2"])
|
68
69
|
s.add_dependency(%q<active_record>, [">= 3.0.0.beta4"])
|
69
|
-
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.11"])
|
70
70
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
71
|
+
s.add_dependency(%q<rspec>, [">= 2.0.0.beta.12"])
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), "spec_helper.rb")
|
2
2
|
|
3
|
-
require 'date_validator'
|
4
|
-
|
5
3
|
create_table "test_records" do end
|
6
4
|
|
7
5
|
define_model('TestRecord', :name => :string, :expiration_date => :date)
|
@@ -12,7 +10,7 @@ describe Remarkable::ActiveModel::Matchers::ValidateDateOfMatcher do
|
|
12
10
|
@model = TestRecord.new
|
13
11
|
end
|
14
12
|
|
15
|
-
describe "
|
13
|
+
describe "validate_date_of_matcher" do
|
16
14
|
|
17
15
|
[:after, :before, :after_or_equal_to, :before_or_equal_to].each do |check|
|
18
16
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,30 +1,25 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
3
|
|
4
|
+
# encoding: utf-8
|
3
5
|
require 'rubygems'
|
6
|
+
require 'rspec'
|
4
7
|
|
5
|
-
|
6
|
-
RAILS_VERSION = ENV['RAILS_VERSION'] || '3.0.0.beta3'
|
7
|
-
|
8
|
-
# gem 'activesupport', RAILS_VERSION
|
9
|
-
# require 'active_support'
|
10
|
-
|
11
|
-
# gem 'remarkable_activerecord', '4.0.0.alpha3'
|
12
|
-
# require 'remarkable_activerecord' # Automatically requires remarkable active_model and remarkable core
|
8
|
+
RAILS_VERSION = ENV['RAILS_VERSION'] || '3.0.0.beta4'
|
13
9
|
|
10
|
+
# Loads activemodel too
|
14
11
|
gem 'activerecord', RAILS_VERSION
|
15
12
|
require 'active_record'
|
16
13
|
|
14
|
+
gem 'date_validator', '>=0.5.2'
|
15
|
+
require 'date_validator'
|
16
|
+
|
17
17
|
ActiveRecord::Base.establish_connection(
|
18
18
|
:adapter => 'sqlite3',
|
19
19
|
:database => ':memory:'
|
20
20
|
)
|
21
21
|
|
22
|
-
# gem 'remarkable', '>=4.0.0.alpha3'
|
23
|
-
# gem 'remarkable_activemodel', '>=4.0.0.alpha3'
|
24
|
-
|
25
22
|
dir = File.dirname(__FILE__)
|
26
23
|
require File.join(dir, "..", "lib", "remarkable", "date_validator.rb")
|
27
24
|
require File.join(dir, "model_builder")
|
28
25
|
include ModelBuilder
|
29
|
-
|
30
|
-
Remarkable.include_matchers!(Remarkable::ActiveModel, Rspec::Core::ExampleGroup)
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remarkable_date_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Oriol Gual
|
@@ -16,16 +17,18 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2010-06-
|
20
|
+
date: 2010-06-19 00:00:00 +02:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
23
24
|
name: remarkable
|
24
25
|
prerelease: false
|
25
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
26
28
|
requirements:
|
27
29
|
- - ">="
|
28
30
|
- !ruby/object:Gem::Version
|
31
|
+
hash: 436503182
|
29
32
|
segments:
|
30
33
|
- 4
|
31
34
|
- 0
|
@@ -38,9 +41,11 @@ dependencies:
|
|
38
41
|
name: remarkable_activemodel
|
39
42
|
prerelease: false
|
40
43
|
requirement: &id002 !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
41
45
|
requirements:
|
42
46
|
- - ">="
|
43
47
|
- !ruby/object:Gem::Version
|
48
|
+
hash: 436503182
|
44
49
|
segments:
|
45
50
|
- 4
|
46
51
|
- 0
|
@@ -53,23 +58,27 @@ dependencies:
|
|
53
58
|
name: date_validator
|
54
59
|
prerelease: false
|
55
60
|
requirement: &id003 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
56
62
|
requirements:
|
57
63
|
- - ">="
|
58
64
|
- !ruby/object:Gem::Version
|
65
|
+
hash: 15
|
59
66
|
segments:
|
60
67
|
- 0
|
61
|
-
-
|
68
|
+
- 5
|
62
69
|
- 2
|
63
|
-
version: 0.
|
70
|
+
version: 0.5.2
|
64
71
|
type: :runtime
|
65
72
|
version_requirements: *id003
|
66
73
|
- !ruby/object:Gem::Dependency
|
67
74
|
name: active_record
|
68
75
|
prerelease: false
|
69
76
|
requirement: &id004 !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
70
78
|
requirements:
|
71
79
|
- - ">="
|
72
80
|
- !ruby/object:Gem::Version
|
81
|
+
hash: 299253624
|
73
82
|
segments:
|
74
83
|
- 3
|
75
84
|
- 0
|
@@ -79,31 +88,35 @@ dependencies:
|
|
79
88
|
type: :development
|
80
89
|
version_requirements: *id004
|
81
90
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
91
|
+
name: sqlite3
|
83
92
|
prerelease: false
|
84
93
|
requirement: &id005 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
85
95
|
requirements:
|
86
96
|
- - ">="
|
87
97
|
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
88
99
|
segments:
|
89
|
-
- 2
|
90
|
-
- 0
|
91
100
|
- 0
|
92
|
-
|
93
|
-
- 11
|
94
|
-
version: 2.0.0.beta.11
|
101
|
+
version: "0"
|
95
102
|
type: :development
|
96
103
|
version_requirements: *id005
|
97
104
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
105
|
+
name: rspec
|
99
106
|
prerelease: false
|
100
107
|
requirement: &id006 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
101
109
|
requirements:
|
102
110
|
- - ">="
|
103
111
|
- !ruby/object:Gem::Version
|
112
|
+
hash: 62196475
|
104
113
|
segments:
|
114
|
+
- 2
|
105
115
|
- 0
|
106
|
-
|
116
|
+
- 0
|
117
|
+
- beta
|
118
|
+
- 12
|
119
|
+
version: 2.0.0.beta.12
|
107
120
|
type: :development
|
108
121
|
version_requirements: *id006
|
109
122
|
description: Remarkable matchers for date_validator
|
@@ -118,6 +131,7 @@ extra_rdoc_files:
|
|
118
131
|
files:
|
119
132
|
- .document
|
120
133
|
- .gitignore
|
134
|
+
- .rspec
|
121
135
|
- LICENSE
|
122
136
|
- README.rdoc
|
123
137
|
- Rakefile
|
@@ -139,23 +153,27 @@ rdoc_options:
|
|
139
153
|
require_paths:
|
140
154
|
- lib
|
141
155
|
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
142
157
|
requirements:
|
143
158
|
- - ">="
|
144
159
|
- !ruby/object:Gem::Version
|
160
|
+
hash: 3
|
145
161
|
segments:
|
146
162
|
- 0
|
147
163
|
version: "0"
|
148
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
none: false
|
149
166
|
requirements:
|
150
167
|
- - ">="
|
151
168
|
- !ruby/object:Gem::Version
|
169
|
+
hash: 3
|
152
170
|
segments:
|
153
171
|
- 0
|
154
172
|
version: "0"
|
155
173
|
requirements: []
|
156
174
|
|
157
175
|
rubyforge_project:
|
158
|
-
rubygems_version: 1.3.
|
176
|
+
rubygems_version: 1.3.7
|
159
177
|
signing_key:
|
160
178
|
specification_version: 3
|
161
179
|
summary: Remarkable matchers for date_validator
|