valle 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/CONTRIBUTING.md +33 -0
- data/Gemfile +9 -7
- data/LICENSE +1 -1
- data/README.md +3 -1
- data/features/configuration.feature +3 -3
- data/features/sets_validations.feature +1 -1
- data/lib/valle/hooks.rb +9 -3
- data/lib/valle/version.rb +1 -1
- data/test/lib/abstract_adapter/character_limited_column_test.rb +3 -3
- data/test/lib/abstract_adapter/column_wrapper_test.rb +1 -1
- data/test/test_helper.rb +4 -2
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c0c148d64fc0b076b0575401d9c4918333fb7b8
|
4
|
+
data.tar.gz: 94db8d353ef331cd637eba7186e2509ab021035f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb10fe590b5426ed77e95da67aabd3800379a6d3afc2c625f22a48c08e3e6b91c1ad9787e84b15d4f6da1a1dd38f2314332320dbc1a5e2c26d92840ee9bec0d0
|
7
|
+
data.tar.gz: feb65d2c8e597d4623f35e72735f886318ba3a17cf18ec2aa7b5b58d2be315cca52f4c66d722372a5a3d2ac392036fdd9bb04b80d8450c1f7ce7e6a5679ffabb
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
We love pull requests. Here's a quick guide.
|
4
|
+
|
5
|
+
Fork, then clone the repo:
|
6
|
+
|
7
|
+
git clone git@github.com:your-username/valle.git
|
8
|
+
|
9
|
+
Make sure the tests pass:
|
10
|
+
|
11
|
+
rake
|
12
|
+
|
13
|
+
Make your change. Add tests for your change. Make the tests pass:
|
14
|
+
|
15
|
+
rake
|
16
|
+
|
17
|
+
Push to your fork and [submit a pull request][pr].
|
18
|
+
|
19
|
+
[pr]: https://github.com/kaize/valle/compare/
|
20
|
+
|
21
|
+
At this point you're waiting on us. We like to at least comment on pull requests
|
22
|
+
within three business days (and, typically, one business day). We may suggest
|
23
|
+
some changes or improvements or alternatives.
|
24
|
+
|
25
|
+
Some things that will increase the chance that your pull request is accepted:
|
26
|
+
|
27
|
+
* Write tests.
|
28
|
+
* Follow common [style guides][style].
|
29
|
+
* Write a [good commit message][commit].
|
30
|
+
* squash your commits before sending PR.
|
31
|
+
|
32
|
+
[style]: https://github.com/thoughtbot/guides/tree/master/style
|
33
|
+
[commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
data/Gemfile
CHANGED
@@ -3,11 +3,13 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in valle.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'rails', '~> 4.0.0'
|
7
|
-
|
8
6
|
gem 'rake'
|
9
|
-
|
10
|
-
|
11
|
-
gem '
|
12
|
-
|
13
|
-
gem '
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
gem 'rails', '~> 4.1.0'
|
10
|
+
|
11
|
+
gem 'minitest', '~> 5'
|
12
|
+
gem 'minitest-reporters'
|
13
|
+
gem 'cucumber'
|
14
|
+
gem 'aruba'
|
15
|
+
end
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -88,12 +88,14 @@ There is a similar gem, called [validates_lengths_from_database](http://github.c
|
|
88
88
|
|
89
89
|
## Credits
|
90
90
|
|
91
|
-
|
91
|
+
Authors:
|
92
92
|
|
93
93
|
- [Anton Kalyaev](http://github.com/akalyaev)
|
94
94
|
- [Andrew Kulakov](http://github.com/Andrew8xx8)
|
95
95
|
- [Alexander Kirillov](http://github.com/saratovsource)
|
96
96
|
|
97
|
+
Maintained by kaize team.
|
98
|
+
|
97
99
|
Thank you to all our amazing [contributors](http://github.com/kaize/valle/contributors)!
|
98
100
|
|
99
101
|
## License
|
@@ -35,7 +35,7 @@ Feature:
|
|
35
35
|
end
|
36
36
|
"""
|
37
37
|
When I successfully run `bundle exec rake test --trace`
|
38
|
-
Then the output should contain "1
|
38
|
+
Then the output should contain "1 runs, 1 assertions, 0 failures, 0 errors"
|
39
39
|
|
40
40
|
Scenario: Using the exclude_models option should skip the models specified in the list
|
41
41
|
When I successfully run `bundle exec rails g model Post title:string`
|
@@ -76,7 +76,7 @@ Feature:
|
|
76
76
|
end
|
77
77
|
"""
|
78
78
|
When I successfully run `bundle exec rake test --trace`
|
79
|
-
Then the output should contain "2
|
79
|
+
Then the output should contain "2 runs, 3 assertions, 0 failures, 0 errors"
|
80
80
|
|
81
81
|
Scenario: Using exclude_attributes option should allow us to skip some attributes
|
82
82
|
When I write to "config/initializers/valle.rb" with:
|
@@ -103,4 +103,4 @@ Feature:
|
|
103
103
|
end
|
104
104
|
"""
|
105
105
|
When I successfully run `bundle exec rake test --trace`
|
106
|
-
Then the output should contain "1
|
106
|
+
Then the output should contain "1 runs, 1 assertions, 0 failures, 0 errors"
|
data/lib/valle/hooks.rb
CHANGED
@@ -50,9 +50,15 @@ module Valle
|
|
50
50
|
# skip AR::SchemaMigration (AR >= 4.X)
|
51
51
|
return false if (defined?(ActiveRecord::SchemaMigration) && subclass == ActiveRecord::SchemaMigration)
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
begin
|
54
|
+
model_name = subclass.model_name
|
55
|
+
|
56
|
+
Valle.can_process_model?(model_name) &&
|
57
|
+
inherited_from_class == ActiveRecord::Base &&
|
58
|
+
subclass.table_exists?
|
59
|
+
rescue ArgumentError
|
60
|
+
false
|
61
|
+
end
|
56
62
|
end
|
57
63
|
end
|
58
64
|
end
|
data/lib/valle/version.rb
CHANGED
@@ -3,21 +3,21 @@ require "test_helper"
|
|
3
3
|
class CharacterLimitedColumnTest < TestCase
|
4
4
|
|
5
5
|
def test_maximum_should_return_value_for_string_column
|
6
|
-
original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", "
|
6
|
+
original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", "varchar(255)")
|
7
7
|
column = Valle::AbstractAdapter::CharacterLimitedColumn.new(original_column)
|
8
8
|
|
9
9
|
assert column.maximum
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_maximum_should_return_correct_value_for_string_column_if_user_redefine_limit
|
13
|
-
original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", "
|
13
|
+
original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", "varchar(200)")
|
14
14
|
column = Valle::AbstractAdapter::CharacterLimitedColumn.new(original_column)
|
15
15
|
|
16
16
|
assert_equal 200, column.maximum
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_minimum_should_return_nil
|
20
|
-
original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", "
|
20
|
+
original_column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", "varchar")
|
21
21
|
column = Valle::AbstractAdapter::CharacterLimitedColumn.new(original_column)
|
22
22
|
|
23
23
|
assert_nil column.minimum
|
@@ -4,7 +4,7 @@ require "active_record"
|
|
4
4
|
class ColumnWrapperTest < TestCase
|
5
5
|
|
6
6
|
def test_wrap_should_return_instance_of_character_limited_column_for_string_column
|
7
|
-
column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", "
|
7
|
+
column = ::ActiveRecord::ConnectionAdapters::Column.new("test_column", "", "varchar(255)")
|
8
8
|
wrapped_column = Valle::AbstractAdapter::ColumnWrapper.wrap(column)
|
9
9
|
|
10
10
|
assert wrapped_column.is_a?(Valle::AbstractAdapter::CharacterLimitedColumn)
|
data/test/test_helper.rb
CHANGED
@@ -3,7 +3,9 @@ Bundler.require
|
|
3
3
|
|
4
4
|
require "active_record"
|
5
5
|
|
6
|
-
|
6
|
+
require 'minitest/autorun'
|
7
|
+
require "minitest/reporters"
|
8
|
+
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
7
9
|
|
8
|
-
class TestCase < MiniTest::
|
10
|
+
class TestCase < MiniTest::Test
|
9
11
|
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Kalyaev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Valle automatically sets minimum and maximum values for the fields of
|
@@ -47,9 +47,10 @@ executables: []
|
|
47
47
|
extensions: []
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
-
- .gitignore
|
51
|
-
- .travis.yml
|
50
|
+
- ".gitignore"
|
51
|
+
- ".travis.yml"
|
52
52
|
- CHANGELOG.md
|
53
|
+
- CONTRIBUTING.md
|
53
54
|
- Gemfile
|
54
55
|
- LICENSE
|
55
56
|
- README.md
|
@@ -84,17 +85,17 @@ require_paths:
|
|
84
85
|
- lib
|
85
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
87
|
requirements:
|
87
|
-
- -
|
88
|
+
- - ">="
|
88
89
|
- !ruby/object:Gem::Version
|
89
90
|
version: '0'
|
90
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
92
|
requirements:
|
92
|
-
- -
|
93
|
+
- - ">="
|
93
94
|
- !ruby/object:Gem::Version
|
94
95
|
version: '0'
|
95
96
|
requirements: []
|
96
97
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.2.2
|
98
99
|
signing_key:
|
99
100
|
specification_version: 4
|
100
101
|
summary: Built-in limit validations for your ActiveRecord model.
|