validates_lengths_from_database 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
validates_lengths_from_database (0.1.2)
|
5
|
+
activerecord (>= 2.3.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (3.0.6)
|
11
|
+
activesupport (= 3.0.6)
|
12
|
+
builder (~> 2.1.2)
|
13
|
+
i18n (~> 0.5.0)
|
14
|
+
activerecord (3.0.6)
|
15
|
+
activemodel (= 3.0.6)
|
16
|
+
activesupport (= 3.0.6)
|
17
|
+
arel (~> 2.0.2)
|
18
|
+
tzinfo (~> 0.3.23)
|
19
|
+
activesupport (3.0.6)
|
20
|
+
arel (2.0.9)
|
21
|
+
builder (2.1.2)
|
22
|
+
diff-lcs (1.1.2)
|
23
|
+
i18n (0.5.0)
|
24
|
+
rspec (2.5.0)
|
25
|
+
rspec-core (~> 2.5.0)
|
26
|
+
rspec-expectations (~> 2.5.0)
|
27
|
+
rspec-mocks (~> 2.5.0)
|
28
|
+
rspec-core (2.5.1)
|
29
|
+
rspec-expectations (2.5.0)
|
30
|
+
diff-lcs (~> 1.1.2)
|
31
|
+
rspec-mocks (2.5.0)
|
32
|
+
sqlite3 (1.3.3)
|
33
|
+
sqlite3-ruby (1.3.3)
|
34
|
+
sqlite3 (>= 1.3.3)
|
35
|
+
tzinfo (0.3.26)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
activerecord (>= 2.3.2)
|
42
|
+
rspec (~> 2.0)
|
43
|
+
sqlite3-ruby (~> 1.3.1)
|
44
|
+
validates_lengths_from_database!
|
@@ -11,6 +11,8 @@ module ValidatesLengthsFromDatabase
|
|
11
11
|
def validates_lengths_from_database(options = {})
|
12
12
|
options.symbolize_keys!
|
13
13
|
|
14
|
+
return false unless self.table_exists?
|
15
|
+
|
14
16
|
raise ArgumentError, "The :only option to validates_lengths_from_database must be an array." if options[:only] and !options[:only].is_a?(Array)
|
15
17
|
raise ArgumentError, "The :except option to validates_lengths_from_database must be an array." if options[:except] and !options[:except].is_a?(Array)
|
16
18
|
|
data/spec/db/test.sqlite3
CHANGED
Binary file
|
@@ -18,6 +18,17 @@ describe ValidatesLengthsFromDatabase do
|
|
18
18
|
:integer_1 => 123
|
19
19
|
}
|
20
20
|
|
21
|
+
context "Model without associated table" do
|
22
|
+
specify "defining validates_lengths_from_database should not raise an error" do
|
23
|
+
lambda {
|
24
|
+
class InvalidTableArticle < ActiveRecord::Base
|
25
|
+
set_table_name "articles_invalid"
|
26
|
+
validates_lengths_from_database
|
27
|
+
end
|
28
|
+
}.should_not raise_error
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
21
32
|
context "Model with validates_lengths_from_database" do
|
22
33
|
before do
|
23
34
|
class ArticleValidateAll < ActiveRecord::Base
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_lengths_from_database
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ben Hughes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-15 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- spec/validates_lengths_from_database_spec.rb
|
85
85
|
- rails/init.rb
|
86
86
|
- Gemfile
|
87
|
+
- Gemfile.lock
|
87
88
|
- LICENSE
|
88
89
|
- Rakefile
|
89
90
|
- README.rdoc
|