enumerize 2.2.1 → 2.5.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.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +73 -0
- data/CHANGELOG.md +35 -1
- data/Gemfile +2 -3
- data/Gemfile.global +2 -10
- data/Gemfile.mongo_mapper +2 -3
- data/Gemfile.rails60 +6 -0
- data/Gemfile.rails61 +6 -0
- data/Gemfile.rails70 +9 -0
- data/Gemfile.railsmaster +5 -0
- data/README.md +205 -94
- data/Rakefile +2 -0
- data/lib/enumerize/activemodel.rb +2 -0
- data/lib/enumerize/activerecord.rb +36 -2
- data/lib/enumerize/attribute.rb +19 -11
- data/lib/enumerize/attribute_map.rb +2 -0
- data/lib/enumerize/base.rb +6 -6
- data/lib/enumerize/hooks/formtastic.rb +4 -1
- data/lib/enumerize/hooks/sequel_dataset.rb +2 -0
- data/lib/enumerize/hooks/simple_form.rb +4 -1
- data/lib/enumerize/hooks/uniqueness.rb +2 -0
- data/lib/enumerize/integrations/rails_admin.rb +2 -0
- data/lib/enumerize/integrations/rspec/matcher.rb +7 -2
- data/lib/enumerize/integrations/rspec.rb +2 -0
- data/lib/enumerize/module.rb +2 -0
- data/lib/enumerize/module_attributes.rb +2 -0
- data/lib/enumerize/mongoid.rb +16 -0
- data/lib/enumerize/predicatable.rb +3 -1
- data/lib/enumerize/predicates.rb +2 -0
- data/lib/enumerize/scope/activerecord.rb +16 -0
- data/lib/enumerize/scope/mongoid.rb +15 -0
- data/lib/enumerize/scope/sequel.rb +16 -0
- data/lib/enumerize/sequel.rb +9 -4
- data/lib/enumerize/set.rb +2 -0
- data/lib/enumerize/utils.rb +12 -0
- data/lib/enumerize/value.rb +14 -15
- data/lib/enumerize/version.rb +1 -1
- data/lib/enumerize.rb +4 -0
- data/lib/sequel/plugins/enumerize.rb +2 -0
- data/spec/enumerize/integrations/rspec/matcher_spec.rb +13 -10
- data/spec/spec_helper.rb +2 -0
- data/test/activemodel_test.rb +24 -22
- data/test/activerecord_test.rb +229 -92
- data/test/attribute_map_test.rb +9 -7
- data/test/attribute_test.rb +37 -30
- data/test/base_test.rb +38 -36
- data/test/formtastic_test.rb +17 -0
- data/test/module_attributes_test.rb +10 -8
- data/test/mongo_mapper_test.rb +19 -10
- data/test/mongoid_test.rb +51 -22
- data/test/multiple_test.rb +15 -7
- data/test/predicates_test.rb +20 -18
- data/test/rails_admin_test.rb +4 -2
- data/test/sequel_test.rb +100 -47
- data/test/set_test.rb +25 -23
- data/test/simple_form_test.rb +17 -0
- data/test/support/mock_controller.rb +2 -0
- data/test/support/shared_enums.rb +43 -0
- data/test/support/view_test_helper.rb +14 -1
- data/test/test_helper.rb +2 -0
- data/test/value_test.rb +51 -30
- metadata +11 -30
- data/.travis.yml +0 -35
- data/Gemfile.rails42 +0 -7
- data/Gemfile.rails50 +0 -7
- data/Gemfile.rails52 +0 -7
data/test/set_test.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_helper'
|
|
2
4
|
require 'yaml'
|
|
3
5
|
|
|
@@ -39,36 +41,36 @@ describe Enumerize::Set do
|
|
|
39
41
|
end
|
|
40
42
|
|
|
41
43
|
it 'equals to other set' do
|
|
42
|
-
set.must_equal Enumerize::Set.new(nil, kklass.foo, %w(a))
|
|
44
|
+
expect(set).must_equal Enumerize::Set.new(nil, kklass.foo, %w(a))
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
it 'equals to array' do
|
|
46
|
-
set.must_equal %w(a)
|
|
48
|
+
expect(set).must_equal %w(a)
|
|
47
49
|
end
|
|
48
50
|
|
|
49
51
|
it 'equals to array of symbols' do
|
|
50
|
-
set.must_equal [:a]
|
|
52
|
+
expect(set).must_equal [:a]
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
it 'has unique values' do
|
|
54
56
|
set << :a
|
|
55
|
-
set.must_equal %w(a)
|
|
57
|
+
expect(set).must_equal %w(a)
|
|
56
58
|
end
|
|
57
59
|
|
|
58
60
|
it 'equals to array with different value order' do
|
|
59
61
|
set << :b
|
|
60
|
-
set.must_equal %w(b a)
|
|
62
|
+
expect(set).must_equal %w(b a)
|
|
61
63
|
end
|
|
62
64
|
|
|
63
65
|
it "isn't equal to a part of values" do
|
|
64
66
|
set << :b
|
|
65
|
-
set.wont_equal %w(a)
|
|
67
|
+
expect(set).wont_equal %w(a)
|
|
66
68
|
end
|
|
67
69
|
|
|
68
70
|
describe '#push' do
|
|
69
71
|
it 'appends values' do
|
|
70
72
|
set.push :b
|
|
71
|
-
set.must_include :b
|
|
73
|
+
expect(set).must_include :b
|
|
72
74
|
end
|
|
73
75
|
|
|
74
76
|
it 'reassigns attribute' do
|
|
@@ -81,7 +83,7 @@ describe Enumerize::Set do
|
|
|
81
83
|
describe '#delete' do
|
|
82
84
|
it 'deletes value' do
|
|
83
85
|
set.delete :a
|
|
84
|
-
set.wont_include :a
|
|
86
|
+
expect(set).wont_include :a
|
|
85
87
|
end
|
|
86
88
|
|
|
87
89
|
it 'reassigns attribute' do
|
|
@@ -94,64 +96,64 @@ describe Enumerize::Set do
|
|
|
94
96
|
describe '#inspect' do
|
|
95
97
|
it 'returns custom string' do
|
|
96
98
|
set << :b
|
|
97
|
-
set.inspect.must_equal '#<Enumerize::Set {a, b}>'
|
|
99
|
+
expect(set.inspect).must_equal '#<Enumerize::Set {a, b}>'
|
|
98
100
|
end
|
|
99
101
|
end
|
|
100
102
|
|
|
101
103
|
describe '#to_ary' do
|
|
102
104
|
it 'returns array' do
|
|
103
|
-
set.to_ary.must_be_instance_of Array
|
|
105
|
+
expect(set.to_ary).must_be_instance_of Array
|
|
104
106
|
end
|
|
105
107
|
end
|
|
106
108
|
|
|
107
109
|
describe '#texts' do
|
|
108
110
|
it 'returns array of text values' do
|
|
109
|
-
set.texts.must_equal ['A']
|
|
111
|
+
expect(set.texts).must_equal ['A']
|
|
110
112
|
end
|
|
111
113
|
end
|
|
112
114
|
|
|
113
115
|
describe '#join' do
|
|
114
116
|
it 'joins values' do
|
|
115
117
|
set << :b
|
|
116
|
-
set.join(', ').must_equal 'a, b'
|
|
118
|
+
expect(set.join(', ')).must_equal 'a, b'
|
|
117
119
|
end
|
|
118
120
|
end
|
|
119
121
|
|
|
120
122
|
describe 'boolean methods comparison' do
|
|
121
123
|
it 'returns true if value equals method' do
|
|
122
124
|
set << :a
|
|
123
|
-
set.a
|
|
125
|
+
expect(set.a?).must_equal true
|
|
124
126
|
end
|
|
125
127
|
|
|
126
128
|
it 'returns false if value does not equal method' do
|
|
127
129
|
set << :a
|
|
128
|
-
set.b
|
|
130
|
+
expect(set.b?).must_equal false
|
|
129
131
|
end
|
|
130
132
|
|
|
131
133
|
it 'raises NoMethodError if there are no values like boolean method' do
|
|
132
|
-
proc {
|
|
134
|
+
expect(proc {
|
|
133
135
|
set.some_method?
|
|
134
|
-
}.must_raise NoMethodError
|
|
136
|
+
}).must_raise NoMethodError
|
|
135
137
|
end
|
|
136
138
|
|
|
137
139
|
it 'raises ArgumentError if arguments are passed' do
|
|
138
|
-
proc {
|
|
140
|
+
expect(proc {
|
|
139
141
|
set.a?('<3')
|
|
140
|
-
}.must_raise ArgumentError
|
|
142
|
+
}).must_raise ArgumentError
|
|
141
143
|
end
|
|
142
144
|
|
|
143
145
|
it 'responds to methods for existing values' do
|
|
144
|
-
set.must_respond_to :a?
|
|
145
|
-
set.must_respond_to :b?
|
|
146
|
-
set.must_respond_to :c?
|
|
146
|
+
expect(set).must_respond_to :a?
|
|
147
|
+
expect(set).must_respond_to :b?
|
|
148
|
+
expect(set).must_respond_to :c?
|
|
147
149
|
end
|
|
148
150
|
|
|
149
151
|
it 'returns a method object' do
|
|
150
|
-
set.method(:a?).must_be_instance_of Method
|
|
152
|
+
expect(set.method(:a?)).must_be_instance_of Method
|
|
151
153
|
end
|
|
152
154
|
|
|
153
155
|
it 'does not respond to a method for not existing value' do
|
|
154
|
-
set.wont_respond_to :some_method?
|
|
156
|
+
expect(set).wont_respond_to :some_method?
|
|
155
157
|
end
|
|
156
158
|
end
|
|
157
159
|
|
data/test/simple_form_test.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_helper'
|
|
2
4
|
require 'simple_form/version'
|
|
3
5
|
|
|
@@ -40,6 +42,12 @@ class SimpleFormSpec < MiniTest::Spec
|
|
|
40
42
|
end
|
|
41
43
|
end
|
|
42
44
|
|
|
45
|
+
class Registration < Struct.new(:sex)
|
|
46
|
+
extend Enumerize
|
|
47
|
+
|
|
48
|
+
enumerize :sex, in: [:male, :female]
|
|
49
|
+
end
|
|
50
|
+
|
|
43
51
|
let(:user) { User.new }
|
|
44
52
|
let(:post) { Post.new }
|
|
45
53
|
|
|
@@ -129,6 +137,15 @@ class SimpleFormSpec < MiniTest::Spec
|
|
|
129
137
|
assert_select 'input.string'
|
|
130
138
|
end
|
|
131
139
|
|
|
140
|
+
it 'renders select with enumerized values for non-ActiveModel object' do
|
|
141
|
+
concat(simple_form_for(Registration.new, as: 'registration', url: '/') do |f|
|
|
142
|
+
f.input(:sex)
|
|
143
|
+
end)
|
|
144
|
+
|
|
145
|
+
assert_select 'select option[value=male]'
|
|
146
|
+
assert_select 'select option[value=female]'
|
|
147
|
+
end
|
|
148
|
+
|
|
132
149
|
it 'does not affect forms without object' do
|
|
133
150
|
concat(simple_form_for('') do |f|
|
|
134
151
|
f.input(:name)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'active_record'
|
|
4
|
+
require 'sequel'
|
|
5
|
+
|
|
6
|
+
module EnumerizeExtention
|
|
7
|
+
def self.included(base)
|
|
8
|
+
case
|
|
9
|
+
when base < ActiveRecord::Base
|
|
10
|
+
base.extend Enumerize
|
|
11
|
+
when base < Sequel::Model
|
|
12
|
+
base.plugin :enumerize
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module SkipValidationsEnum
|
|
18
|
+
def self.included(base)
|
|
19
|
+
base.include EnumerizeExtention
|
|
20
|
+
base.enumerize :foo, :in => [:bar, :baz], :skip_validations => true
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
module DoNotSkipValidationsEnum
|
|
25
|
+
def self.included(base)
|
|
26
|
+
base.include EnumerizeExtention
|
|
27
|
+
base.enumerize :foo, :in => [:bar, :baz], :skip_validations => false
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
module SkipValidationsLambdaEnum
|
|
32
|
+
def self.included(base)
|
|
33
|
+
base.include EnumerizeExtention
|
|
34
|
+
base.enumerize :foo, :in => [:bar, :baz], :skip_validations => lambda { true }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
module SkipValidationsLambdaWithParamEnum
|
|
39
|
+
def self.included(base)
|
|
40
|
+
base.include EnumerizeExtention
|
|
41
|
+
base.enumerize :foo, :in => [:bar, :baz], :skip_validations => lambda { |record| true }
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'active_support/concern'
|
|
2
4
|
require 'active_support/testing/setup_and_teardown'
|
|
3
5
|
|
|
@@ -5,10 +7,21 @@ if defined?(ActionView::RoutingUrlFor)
|
|
|
5
7
|
ActionView::RoutingUrlFor.send(:include, ActionDispatch::Routing::UrlFor)
|
|
6
8
|
end
|
|
7
9
|
|
|
8
|
-
module
|
|
10
|
+
module SetupAndTeardownHelper
|
|
9
11
|
extend ActiveSupport::Concern
|
|
10
12
|
|
|
11
13
|
include ActiveSupport::Testing::SetupAndTeardown
|
|
14
|
+
|
|
15
|
+
included do
|
|
16
|
+
include ActiveSupport::Callbacks
|
|
17
|
+
define_callbacks :setup, :teardown
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
module ViewTestHelper
|
|
22
|
+
extend ActiveSupport::Concern
|
|
23
|
+
|
|
24
|
+
include SetupAndTeardownHelper
|
|
12
25
|
include ActionView::TestCase::Behavior
|
|
13
26
|
|
|
14
27
|
included do
|
data/test/test_helper.rb
CHANGED
data/test/value_test.rb
CHANGED
|
@@ -1,46 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'test_helper'
|
|
2
4
|
require 'yaml'
|
|
3
5
|
|
|
4
6
|
describe Enumerize::Value do
|
|
5
|
-
class
|
|
7
|
+
class Model
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class Attr < Struct.new(:values, :name, :i18n_scopes, :klass)
|
|
6
11
|
end
|
|
7
12
|
|
|
8
|
-
let(:attr) { Attr.new([]) }
|
|
9
|
-
let(:val)
|
|
13
|
+
let(:attr) { Attr.new([], "attribute_name", [], Model) }
|
|
14
|
+
let(:val) { Enumerize::Value.new(attr, 'test_value', 1) }
|
|
10
15
|
|
|
11
16
|
it 'is a string' do
|
|
12
|
-
val.must_be_kind_of String
|
|
17
|
+
expect(val).must_be_kind_of String
|
|
13
18
|
end
|
|
14
19
|
|
|
15
20
|
describe 'equality' do
|
|
16
21
|
it 'is compared to string' do
|
|
17
|
-
val.must_be :==, 'test_value'
|
|
18
|
-
val.wont_be :==, 'not_value'
|
|
22
|
+
expect(val).must_be :==, 'test_value'
|
|
23
|
+
expect(val).wont_be :==, 'not_value'
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
it 'is compared to symbol' do
|
|
22
|
-
val.must_be :==, :test_value
|
|
23
|
-
val.wont_be :==, :not_value
|
|
27
|
+
expect(val).must_be :==, :test_value
|
|
28
|
+
expect(val).wont_be :==, :not_value
|
|
24
29
|
end
|
|
25
30
|
|
|
26
31
|
it 'is compared to integer' do
|
|
27
|
-
val.must_be :==, 1
|
|
28
|
-
val.wont_be :==, 2
|
|
32
|
+
expect(val).must_be :==, 1
|
|
33
|
+
expect(val).wont_be :==, 2
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
|
|
32
37
|
describe 'translation' do
|
|
33
|
-
let(:attr) { Struct.new(:values, :name, :i18n_scopes).new([], "attribute_name", []) }
|
|
34
|
-
|
|
35
38
|
it 'uses common translation' do
|
|
36
39
|
store_translations(:en, :enumerize => {:attribute_name => {:test_value => "Common translation"}}) do
|
|
37
|
-
val.text.must_be :==, "Common translation"
|
|
40
|
+
expect(val.text).must_be :==, "Common translation"
|
|
38
41
|
end
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
it 'uses default translation from the "default" section if its present' do
|
|
42
45
|
store_translations(:en, :enumerize => {:defaults => {:attribute_name => {:test_value => "Common translation"}}}) do
|
|
43
|
-
val.text.must_be :==, "Common translation"
|
|
46
|
+
expect(val.text).must_be :==, "Common translation"
|
|
44
47
|
end
|
|
45
48
|
end
|
|
46
49
|
|
|
@@ -48,7 +51,7 @@ describe Enumerize::Value do
|
|
|
48
51
|
attr.i18n_scopes = ["enumerize.model_name.attribute_name"]
|
|
49
52
|
|
|
50
53
|
store_translations(:en, :enumerize => {:model_name => {:attribute_name => {:test_value => "Model Specific translation"}}}) do
|
|
51
|
-
val.text.must_be :==, "Model Specific translation"
|
|
54
|
+
expect(val.text).must_be :==, "Model Specific translation"
|
|
52
55
|
end
|
|
53
56
|
end
|
|
54
57
|
|
|
@@ -56,13 +59,13 @@ describe Enumerize::Value do
|
|
|
56
59
|
attr.i18n_scopes = ["enumerize.model_name.attribute_name"]
|
|
57
60
|
|
|
58
61
|
store_translations(:en, :enumerize => {:attribute_name => {:test_value => "Common translation"}, :model_name => {:attribute_name => {:test_value => "Model Specific translation"}}}) do
|
|
59
|
-
val.text.must_be :==, "Model Specific translation"
|
|
62
|
+
expect(val.text).must_be :==, "Model Specific translation"
|
|
60
63
|
end
|
|
61
64
|
end
|
|
62
65
|
|
|
63
66
|
it 'uses simply humanized value when translation is undefined' do
|
|
64
67
|
store_translations(:en, :enumerize => {}) do
|
|
65
|
-
val.text.must_be :==, "Test value"
|
|
68
|
+
expect(val.text).must_be :==, "Test value"
|
|
66
69
|
end
|
|
67
70
|
end
|
|
68
71
|
|
|
@@ -70,7 +73,7 @@ describe Enumerize::Value do
|
|
|
70
73
|
attr.i18n_scopes = ["other.scope"]
|
|
71
74
|
|
|
72
75
|
store_translations(:en, :other => {:scope => {:test_value => "Scope specific translation"}}) do
|
|
73
|
-
val.text.must_be :==, "Scope specific translation"
|
|
76
|
+
expect(val.text).must_be :==, "Scope specific translation"
|
|
74
77
|
end
|
|
75
78
|
end
|
|
76
79
|
|
|
@@ -78,7 +81,7 @@ describe Enumerize::Value do
|
|
|
78
81
|
attr.i18n_scopes = ["nonexistent.scope", "other.scope"]
|
|
79
82
|
|
|
80
83
|
store_translations(:en, :other => {:scope => {:test_value => "Scope specific translation"}}) do
|
|
81
|
-
val.text.must_be :==, "Scope specific translation"
|
|
84
|
+
expect(val.text).must_be :==, "Scope specific translation"
|
|
82
85
|
end
|
|
83
86
|
end
|
|
84
87
|
end
|
|
@@ -89,36 +92,44 @@ describe Enumerize::Value do
|
|
|
89
92
|
end
|
|
90
93
|
|
|
91
94
|
it 'returns true if value equals method' do
|
|
92
|
-
val.test_value
|
|
95
|
+
expect(val.test_value?).must_equal true
|
|
93
96
|
end
|
|
94
97
|
|
|
95
98
|
it 'returns false if value does not equal method' do
|
|
96
|
-
val.other_value
|
|
99
|
+
expect(val.other_value?).must_equal false
|
|
97
100
|
end
|
|
98
101
|
|
|
99
102
|
it 'raises NoMethodError if there are no values like boolean method' do
|
|
100
|
-
proc {
|
|
103
|
+
expect(proc {
|
|
101
104
|
val.some_method?
|
|
102
|
-
}.must_raise NoMethodError
|
|
105
|
+
}).must_raise NoMethodError
|
|
103
106
|
end
|
|
104
107
|
|
|
105
108
|
it 'raises ArgumentError if arguments are passed' do
|
|
106
|
-
proc {
|
|
109
|
+
expect(proc {
|
|
107
110
|
val.other_value?('<3')
|
|
108
|
-
}.must_raise ArgumentError
|
|
111
|
+
}).must_raise ArgumentError
|
|
109
112
|
end
|
|
110
113
|
|
|
111
114
|
it 'responds to methods for existing values' do
|
|
112
|
-
val.must_respond_to :test_value?
|
|
113
|
-
val.must_respond_to :other_value?
|
|
115
|
+
expect(val).must_respond_to :test_value?
|
|
116
|
+
expect(val).must_respond_to :other_value?
|
|
114
117
|
end
|
|
115
118
|
|
|
116
119
|
it 'returns a method object' do
|
|
117
|
-
val.method(:test_value?).must_be_instance_of Method
|
|
120
|
+
expect(val.method(:test_value?)).must_be_instance_of Method
|
|
118
121
|
end
|
|
119
122
|
|
|
120
123
|
it "doesn't respond to a method for not existing value" do
|
|
121
|
-
val.wont_respond_to :some_method?
|
|
124
|
+
expect(val).wont_respond_to :some_method?
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it "doesn't respond to methods is value was modified" do
|
|
128
|
+
modified_value = val.upcase
|
|
129
|
+
|
|
130
|
+
expect(modified_value.upcase).wont_respond_to :some_method?
|
|
131
|
+
expect(modified_value.upcase).wont_respond_to :test_value?
|
|
132
|
+
expect(modified_value.upcase).wont_respond_to :other_value?
|
|
122
133
|
end
|
|
123
134
|
end
|
|
124
135
|
|
|
@@ -131,7 +142,17 @@ describe Enumerize::Value do
|
|
|
131
142
|
|
|
132
143
|
it 'serializes with Marshal' do
|
|
133
144
|
dump_value = Marshal.dump(val)
|
|
134
|
-
Marshal.load(dump_value).must_equal 'test_value'
|
|
145
|
+
expect(Marshal.load(dump_value)).must_equal 'test_value'
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
describe 'initialize' do
|
|
150
|
+
it 'no output if undefined boolean method' do
|
|
151
|
+
assert_silent() { Enumerize::Value.new(attr, 'test_value') }
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it 'error output if defined boolean method' do
|
|
155
|
+
assert_output(nil, /`empty\?` is defined/) { Enumerize::Value.new(attr, 'empty') }
|
|
135
156
|
end
|
|
136
157
|
end
|
|
137
158
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: enumerize
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergey Nartimov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-12-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -31,16 +31,17 @@ executables: []
|
|
|
31
31
|
extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
|
33
33
|
files:
|
|
34
|
+
- ".github/workflows/ruby.yml"
|
|
34
35
|
- ".gitignore"
|
|
35
36
|
- ".rspec"
|
|
36
|
-
- ".travis.yml"
|
|
37
37
|
- CHANGELOG.md
|
|
38
38
|
- Gemfile
|
|
39
39
|
- Gemfile.global
|
|
40
40
|
- Gemfile.mongo_mapper
|
|
41
|
-
- Gemfile.
|
|
42
|
-
- Gemfile.
|
|
43
|
-
- Gemfile.
|
|
41
|
+
- Gemfile.rails60
|
|
42
|
+
- Gemfile.rails61
|
|
43
|
+
- Gemfile.rails70
|
|
44
|
+
- Gemfile.railsmaster
|
|
44
45
|
- MIT-LICENSE
|
|
45
46
|
- README.md
|
|
46
47
|
- Rakefile
|
|
@@ -68,6 +69,7 @@ files:
|
|
|
68
69
|
- lib/enumerize/scope/sequel.rb
|
|
69
70
|
- lib/enumerize/sequel.rb
|
|
70
71
|
- lib/enumerize/set.rb
|
|
72
|
+
- lib/enumerize/utils.rb
|
|
71
73
|
- lib/enumerize/value.rb
|
|
72
74
|
- lib/enumerize/version.rb
|
|
73
75
|
- lib/sequel/plugins/enumerize.rb
|
|
@@ -89,6 +91,7 @@ files:
|
|
|
89
91
|
- test/set_test.rb
|
|
90
92
|
- test/simple_form_test.rb
|
|
91
93
|
- test/support/mock_controller.rb
|
|
94
|
+
- test/support/shared_enums.rb
|
|
92
95
|
- test/support/view_test_helper.rb
|
|
93
96
|
- test/test_helper.rb
|
|
94
97
|
- test/value_test.rb
|
|
@@ -111,30 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
111
114
|
- !ruby/object:Gem::Version
|
|
112
115
|
version: '0'
|
|
113
116
|
requirements: []
|
|
114
|
-
|
|
115
|
-
rubygems_version: 2.7.3
|
|
117
|
+
rubygems_version: 3.0.9
|
|
116
118
|
signing_key:
|
|
117
119
|
specification_version: 4
|
|
118
120
|
summary: Enumerated attributes with I18n and ActiveRecord/Mongoid/MongoMapper support
|
|
119
|
-
test_files:
|
|
120
|
-
- spec/enumerize/integrations/rspec/matcher_spec.rb
|
|
121
|
-
- spec/spec_helper.rb
|
|
122
|
-
- test/activemodel_test.rb
|
|
123
|
-
- test/activerecord_test.rb
|
|
124
|
-
- test/attribute_map_test.rb
|
|
125
|
-
- test/attribute_test.rb
|
|
126
|
-
- test/base_test.rb
|
|
127
|
-
- test/formtastic_test.rb
|
|
128
|
-
- test/module_attributes_test.rb
|
|
129
|
-
- test/mongo_mapper_test.rb
|
|
130
|
-
- test/mongoid_test.rb
|
|
131
|
-
- test/multiple_test.rb
|
|
132
|
-
- test/predicates_test.rb
|
|
133
|
-
- test/rails_admin_test.rb
|
|
134
|
-
- test/sequel_test.rb
|
|
135
|
-
- test/set_test.rb
|
|
136
|
-
- test/simple_form_test.rb
|
|
137
|
-
- test/support/mock_controller.rb
|
|
138
|
-
- test/support/view_test_helper.rb
|
|
139
|
-
- test/test_helper.rb
|
|
140
|
-
- test/value_test.rb
|
|
121
|
+
test_files: []
|
data/.travis.yml
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
sudo: false
|
|
3
|
-
services:
|
|
4
|
-
- postgresql
|
|
5
|
-
- mongodb
|
|
6
|
-
gemfile:
|
|
7
|
-
- Gemfile
|
|
8
|
-
- Gemfile.rails42
|
|
9
|
-
- Gemfile.rails50
|
|
10
|
-
- Gemfile.rails52
|
|
11
|
-
- Gemfile.mongo_mapper
|
|
12
|
-
rvm:
|
|
13
|
-
- 2.2.7
|
|
14
|
-
- 2.3.3
|
|
15
|
-
- 2.4.1
|
|
16
|
-
- jruby-9.1.14.0
|
|
17
|
-
env:
|
|
18
|
-
global:
|
|
19
|
-
- DB_USER=postgres
|
|
20
|
-
- DB_PASS=
|
|
21
|
-
matrix:
|
|
22
|
-
- DB=sqlite3
|
|
23
|
-
- DB=postgresql
|
|
24
|
-
matrix:
|
|
25
|
-
fast_finish: true
|
|
26
|
-
allow_failures:
|
|
27
|
-
- rvm: jruby-9.1.14.0
|
|
28
|
-
exclude:
|
|
29
|
-
- gemfile: Gemfile.mongo_mapper
|
|
30
|
-
env: DB=postgresql
|
|
31
|
-
branches:
|
|
32
|
-
only:
|
|
33
|
-
- master
|
|
34
|
-
notifications:
|
|
35
|
-
email: false
|
data/Gemfile.rails42
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
eval_gemfile('Gemfile.global')
|
|
2
|
-
|
|
3
|
-
gem 'minitest', '~> 5.8'
|
|
4
|
-
gem 'rails', '4.2.8', :require => false
|
|
5
|
-
gem 'activerecord-jdbcsqlite3-adapter', '~> 1.3.0', platform: :jruby
|
|
6
|
-
gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3.0', platform: :jruby
|
|
7
|
-
gem 'mongoid', '~> 5.0'
|
data/Gemfile.rails50
DELETED
data/Gemfile.rails52
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
eval_gemfile('Gemfile.global')
|
|
2
|
-
|
|
3
|
-
gem 'minitest', '~> 5.8'
|
|
4
|
-
gem 'rails', '5.2.0.rc1', require: false
|
|
5
|
-
gem 'activerecord-jdbcsqlite3-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'master', platform: :jruby
|
|
6
|
-
gem 'activerecord-jdbcpostgresql-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'master', platform: :jruby
|
|
7
|
-
gem 'mongoid', github: 'mongodb/mongoid'
|