valle 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.1.0 / 2013-11-08
2
+
3
+ * fixed Stack too deep error [Anton Kalyaev]
4
+ * fixed enabled option [Anton Kalyaev]
5
+ * fixed db:migrate error [Anton Kalyaev]
6
+ * dot not override AR#valid? method [Anton Kalyaev]
7
+
1
8
  ## 0.0.3 / 2012-12-13
2
9
 
3
10
  * added primary_key type [Anton Kalyaev]
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in valle.gemspec
4
4
  gemspec
5
5
 
6
- gem 'rails', '~> 3.2.0'
6
+ gem 'rails', '~> 4.0.0'
7
7
 
8
8
  gem 'rake'
9
9
  gem 'minitest'
@@ -15,12 +15,15 @@ Feature: sets validations
15
15
  require 'test_helper'
16
16
 
17
17
  class UserTest < ActiveSupport::TestCase
18
+ setup do
19
+ @user = FactoryGirl.create(:user)
20
+ end
21
+
18
22
  test "should not save user when name is too long" do
19
- user = FactoryGirl.create(:user)
20
- user.name = 'a' * 256
23
+ @user.name = 'a' * 256
21
24
 
22
- assert !user.save
23
- assert_equal 1, user.errors.count
25
+ assert !@user.save
26
+ assert_equal 1, @user.errors.count
24
27
  end
25
28
  end
26
29
  """
data/lib/valle/hooks.rb CHANGED
@@ -20,7 +20,9 @@ module Valle
20
20
  class << self
21
21
  def inherited_with_valle_validators(subclass)
22
22
  inherited_without_valle_validators(subclass)
23
- if Valle.can_process_model?(subclass.model_name)
23
+ if (Valle.can_process_model?(subclass.model_name) &&
24
+ self == ActiveRecord::Base &&
25
+ subclass != ActiveRecord::SchemaMigration)
24
26
  Valle::Hooks.extend_ar_validations_valid_method(subclass)
25
27
  end
26
28
  end
@@ -37,18 +39,7 @@ module Valle
37
39
  # @note ActiveRecord::Validations should be defined at this point
38
40
  #
39
41
  def extend_ar_validations_valid_method(subclass)
40
- subclass.instance_eval do
41
- cattr_accessor :valle_validators
42
- end
43
-
44
- subclass.class_eval do
45
- def valid_with_valle_validators?(context = nil)
46
- self.class.valle_validators ||= Valle::Manager.add_validators(self.class)
47
- valid_without_valle_validators?(context)
48
- end
49
-
50
- alias_method_chain :valid?, :valle_validators
51
- end
42
+ Valle::Manager.add_validators(subclass)
52
43
  end
53
44
  end
54
45
  end
data/lib/valle/railtie.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Valle
2
2
  class Railtie < ::Rails::Railtie #:nodoc:
3
- initializer 'valle.init' do
3
+ config.after_initialize do
4
4
  Valle::Hooks.init
5
5
  end
6
6
  end
data/lib/valle/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Valle
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
data/valle.gemspec CHANGED
@@ -15,6 +15,6 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Valle::VERSION
17
17
 
18
- gem.add_runtime_dependency 'activerecord'
19
- gem.add_runtime_dependency 'activesupport'
18
+ gem.add_dependency 'activerecord', '>= 3.0'
19
+ gem.add_dependency 'activesupport'
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-13 00:00:00.000000000 Z
12
+ date: 2013-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: '3.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activesupport
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -56,7 +56,6 @@ files:
56
56
  - .travis.yml
57
57
  - CHANGELOG.md
58
58
  - Gemfile
59
- - Guardfile
60
59
  - LICENSE
61
60
  - README.md
62
61
  - Rakefile
@@ -94,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
93
  version: '0'
95
94
  segments:
96
95
  - 0
97
- hash: 1309560054681721189
96
+ hash: -1785766048281463164
98
97
  required_rubygems_version: !ruby/object:Gem::Requirement
99
98
  none: false
100
99
  requirements:
@@ -103,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
102
  version: '0'
104
103
  segments:
105
104
  - 0
106
- hash: 1309560054681721189
105
+ hash: -1785766048281463164
107
106
  requirements: []
108
107
  rubyforge_project:
109
108
  rubygems_version: 1.8.24
data/Guardfile DELETED
@@ -1,10 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'minitest', test_folders: "test" do
5
- # with Minitest::Unit
6
- watch(%r|^test/(.*)\/?test_(.*)\.rb|)
7
- watch(%r|^test/(.*)\/?(.*)_test\.rb|)
8
- watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
9
- watch(%r|^test/test_helper\.rb|) { "test" }
10
- end