valhammer 0.1.2 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9465d328d445632ab2a2607b8cac901393548f32
4
- data.tar.gz: d55c0bd7a8175139e6ad219a11ee8deacb04a92e
3
+ metadata.gz: 6ea291bcc9bb1f0c3931b9f5f83b8837f75be21e
4
+ data.tar.gz: 508cdc21ee92a31b986f5dbc9c6d449f5948355a
5
5
  SHA512:
6
- metadata.gz: 4d957f2d9ffbd8bb863de67b61fdd4e169c96e879c0e1439d0ddb6566f9a3806ba11a35b6419bbaeb2c9a255310670f2da3738fa18e4483e895d0da119711d51
7
- data.tar.gz: 8073eb0f3aa152003e81b1f76d5fdd19f6eba9d5d1c9b4e48967bce9175287750769c3a30b91e1be94c6c5ffee0034a6efdcb479bdcf01c8ae04997461c7d6f2
6
+ metadata.gz: 15ccdb15b5890eecf69712db5dd761562389294bbb18eee58aaf76f5a15a7b6ffb73fe50c21fe89974c13ed4e5493f8ceb736c03fc351e34806b6a2f525df9d3
7
+ data.tar.gz: e73bcfc221876e783226d08f9ce828ccb15783b4147df604f89c3259ed9d8f279d54f4b0716f7076c0cce20274d4436f9434f08d3eaf47ec1305728ce2fb1545
data/Guardfile CHANGED
@@ -4,13 +4,13 @@ guard :bundler do
4
4
  end
5
5
 
6
6
  guard :rspec, cmd: 'bundle exec rspec' do
7
- watch(/^spec\/.+_spec\.rb$/)
8
- watch(/^lib\/(.+)\.rb$/) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch(%r{^spec/.+_spec\.rb$})
8
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
9
  watch('spec/spec_helper.rb') { 'spec' }
10
10
  watch(%r{spec/(db|dummy)/.*\.rb}) { 'spec' }
11
11
  end
12
12
 
13
13
  guard :rubocop do
14
14
  watch(/.+\.rb$/)
15
- watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
15
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
16
16
  end
@@ -77,6 +77,8 @@ module Valhammer
77
77
  def valhammer_numeric(validations, column, opts)
78
78
  return unless opts[:numericality]
79
79
 
80
+ return if defined_enums.key?(column.name)
81
+
80
82
  case column.type
81
83
  when :integer
82
84
  validations[:numericality] = { only_integer: true,
@@ -1,3 +1,3 @@
1
1
  module Valhammer
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
data/spec/db/schema.rb CHANGED
@@ -9,6 +9,7 @@ ActiveRecord::Schema.define(version: 0) do
9
9
  t.integer :age, null: true, default: nil
10
10
  t.decimal :gpa, null: false, default: 3.0
11
11
  t.integer :socialness, null: false, default: 5
12
+ t.integer :sex, null: false, default: 0
12
13
  t.boolean :injected, null: false, default: false
13
14
 
14
15
  t.timestamps null: false
@@ -1,5 +1,7 @@
1
1
  class Resource < ActiveRecord::Base
2
2
  belongs_to :organisation
3
3
 
4
+ enum sex: [:mail, :female]
5
+
4
6
  valhammer
5
7
  end
@@ -115,6 +115,10 @@ RSpec.describe Valhammer::Validations do
115
115
  .to include(a_validator_for(:socialness, :numericality, opts))
116
116
  end
117
117
  end
118
+
119
+ context 'when used as enum' do
120
+ it { is_expected.not_to include(a_validator_for(:sex, :numericality)) }
121
+ end
118
122
  end
119
123
 
120
124
  context 'with a numeric column' do
data/valhammer.gemspec CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.license = 'Apache-2.0'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(/^(test|spec|features)\//)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_dependency 'activerecord', '~> 4.1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valhammer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun Mangelsdorf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2015-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord