strip_attributes 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/strip_attributes/version.rb +1 -1
- data/test/strip_attributes_test.rb +5 -5
- data/test/test_helper.rb +8 -4
- metadata +11 -11
@@ -10,27 +10,27 @@ module MockAttributes
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
class StripAllMockRecord <
|
13
|
+
class StripAllMockRecord < Tableless
|
14
14
|
include MockAttributes
|
15
15
|
strip_attributes
|
16
16
|
end
|
17
17
|
|
18
|
-
class StripOnlyOneMockRecord <
|
18
|
+
class StripOnlyOneMockRecord < Tableless
|
19
19
|
include MockAttributes
|
20
20
|
strip_attributes :only => :foo
|
21
21
|
end
|
22
22
|
|
23
|
-
class StripOnlyThreeMockRecord <
|
23
|
+
class StripOnlyThreeMockRecord < Tableless
|
24
24
|
include MockAttributes
|
25
25
|
strip_attributes :only => [:foo, :bar, :biz]
|
26
26
|
end
|
27
27
|
|
28
|
-
class StripExceptOneMockRecord <
|
28
|
+
class StripExceptOneMockRecord < Tableless
|
29
29
|
include MockAttributes
|
30
30
|
strip_attributes :except => :foo
|
31
31
|
end
|
32
32
|
|
33
|
-
class StripExceptThreeMockRecord <
|
33
|
+
class StripExceptThreeMockRecord < Tableless
|
34
34
|
include MockAttributes
|
35
35
|
strip_attributes :except => [:foo, :bar, :biz]
|
36
36
|
end
|
data/test/test_helper.rb
CHANGED
@@ -2,14 +2,18 @@ require "test/unit"
|
|
2
2
|
require "active_record"
|
3
3
|
require "strip_attributes/active_model"
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
# Tableless AR borrowed from
|
6
|
+
# http://stackoverflow.com/questions/937429/activerecordbase-without-table
|
7
|
+
class Tableless < ActiveRecord::Base
|
7
8
|
def self.columns()
|
8
9
|
@columns ||= []
|
9
10
|
end
|
10
11
|
|
11
12
|
def self.column(name, sql_type = nil, default = nil, null = true)
|
12
|
-
|
13
|
-
|
13
|
+
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type, null)
|
14
|
+
end
|
15
|
+
|
16
|
+
def save(validate = true)
|
17
|
+
validate ? valid? : true
|
14
18
|
end
|
15
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strip_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,30 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
16
|
-
requirement: &
|
16
|
+
requirement: &70131326002740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70131326002740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activerecord
|
27
|
-
requirement: &
|
27
|
+
requirement: &70131326002120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 3.0.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70131326002120
|
36
36
|
description: StripAttributes automatically strips all ActiveRecord model attributes
|
37
37
|
of leading and trailing whitespace before validation. If the attribute is blank,
|
38
38
|
it strips the value to nil.
|
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
segments:
|
65
65
|
- 0
|
66
|
-
hash:
|
66
|
+
hash: 2504771381012512959
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
none: false
|
69
69
|
requirements:
|
@@ -72,10 +72,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: '0'
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
hash:
|
75
|
+
hash: 2504771381012512959
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project: strip_attributes
|
78
|
-
rubygems_version: 1.8.
|
78
|
+
rubygems_version: 1.8.10
|
79
79
|
signing_key:
|
80
80
|
specification_version: 3
|
81
81
|
summary: Whitespace cleanup for ActiveRecord attributes
|