validates_lengths_from_database 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc
CHANGED
@@ -2,7 +2,10 @@ require "rubygems"
|
|
2
2
|
require "active_record"
|
3
3
|
|
4
4
|
module ValidatesLengthsFromDatabase
|
5
|
-
|
5
|
+
def self.included(base)
|
6
|
+
base.send(:extend, ClassMethods)
|
7
|
+
base.send(:include, InstanceMethods)
|
8
|
+
end
|
6
9
|
|
7
10
|
module ClassMethods
|
8
11
|
def validates_lengths_from_database(options = {})
|
data/spec/db/test.sqlite3
CHANGED
Binary file
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "rspec"
|
3
|
-
require "factory_girl"
|
4
|
-
require "faker"
|
5
|
-
require "rails"
|
6
3
|
require "active_record"
|
7
|
-
require "active_support"
|
8
4
|
|
9
5
|
# Establish DB Connection
|
10
6
|
config = YAML::load(IO.read(File.join(File.dirname(__FILE__), 'db', 'database.yml')))
|
@@ -15,6 +11,3 @@ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'
|
|
15
11
|
load(File.dirname(__FILE__) + "/db/schema.rb")
|
16
12
|
|
17
13
|
require File.dirname(__FILE__) + '/../init'
|
18
|
-
|
19
|
-
# Load Factories:
|
20
|
-
Dir[File.join(File.dirname(__FILE__), "factories/**/*.rb")].each {|f| require f}
|
@@ -66,7 +66,7 @@ describe ValidatesLengthsFromDatabase do
|
|
66
66
|
|
67
67
|
it "should have errors on only string_1 and text_1" do
|
68
68
|
@article.errors["string_1"].join.should =~ /too long/
|
69
|
-
@article.errors["string_2"].should be_empty
|
69
|
+
(@article.errors["string_2"] || []).should be_empty
|
70
70
|
@article.errors["text_1"].join.should =~ /too long/
|
71
71
|
end
|
72
72
|
end
|
@@ -96,8 +96,8 @@ describe ValidatesLengthsFromDatabase do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
it "should have errors on columns other than string_1 and text_1 only" do
|
99
|
-
@article.errors["string_1"].should be_empty
|
100
|
-
@article.errors["text_1"].should be_empty
|
99
|
+
(@article.errors["string_1"] || []).should be_empty
|
100
|
+
(@article.errors["text_1"] || []).should be_empty
|
101
101
|
@article.errors["string_2"].join.should =~ /too long/
|
102
102
|
end
|
103
103
|
end
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.2
|
10
|
+
version: 0.1.0
|
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:
|
18
|
+
date: 2011-01-01 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -28,10 +28,10 @@ dependencies:
|
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
hash: 7
|
30
30
|
segments:
|
31
|
+
- 2
|
31
32
|
- 3
|
32
|
-
-
|
33
|
-
|
34
|
-
version: 3.0.0
|
33
|
+
- 2
|
34
|
+
version: 2.3.2
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|