enumerize 1.1.0 → 1.1.1
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/CHANGELOG.md +7 -1
- data/Gemfile +1 -1
- data/README.md +6 -0
- data/lib/enumerize/integrations/rspec/matcher.rb +1 -1
- data/lib/enumerize/predicates.rb +1 -1
- data/lib/enumerize/version.rb +1 -1
- data/spec/enumerize/integrations/rspec/matcher_spec.rb +6 -2
- data/spec/spec_helper.rb +4 -0
- data/test/mongoid_test.rb +2 -3
- data/test/predicates_test.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5542a2d4391256f030660b112b5550d304f54364
|
4
|
+
data.tar.gz: 8146fa77598d876ae818b44f923382ec7fa87745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ee6f8b28d3da326a8ab68a9d5a8639b5dca559b58f32d2104364c540911e26a294d7c733a954075be09aa72a5b4890df8304415e69228c89ece1f52b8411cba
|
7
|
+
data.tar.gz: b997d62b2e1e759b50cd89921af5f16a7e88e0356a3eb674540ff5562fdde09259920ca9522f001b38ad33419c251cfbe019305752c6ae2ab9947f4a1caf018b
|
data/CHANGELOG.md
CHANGED
@@ -4,10 +4,16 @@
|
|
4
4
|
|
5
5
|
### bug fix
|
6
6
|
|
7
|
+
## 1.1.1 (January 25, 2016)
|
8
|
+
|
9
|
+
### bug fix
|
10
|
+
|
11
|
+
* Fix exception when using predicate methods and enumerized values have dash in it. (by [@nashby](https://github.com/nashby))
|
12
|
+
|
7
13
|
## 1.1.0 (November 15, 2015)
|
8
14
|
|
9
15
|
### enhancements
|
10
|
-
* Add Sequel support. (by [@mrbrdo](https://github.com/mrbrdo))
|
16
|
+
* Add Sequel support. (by [@mrbrdo](https://github.com/mrbrdo))
|
11
17
|
* Add qualifiers to RSpec matcher. (by [@maurogeorge](https://github.com/maurogeorge))
|
12
18
|
* Support hash in the RSpec matcher. (by [@maurogeorge](https://github.com/maurogeorge))
|
13
19
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -278,6 +278,12 @@ class User < ActiveRecord::Base
|
|
278
278
|
end
|
279
279
|
```
|
280
280
|
|
281
|
+
get an array of all text values:
|
282
|
+
|
283
|
+
```ruby
|
284
|
+
@user.interests.texts # shortcut for @user.interests.map(&:text)
|
285
|
+
```
|
286
|
+
|
281
287
|
### SimpleForm
|
282
288
|
|
283
289
|
If you are using SimpleForm gem you don't need to specify input type (`:select` by default) and collection:
|
data/lib/enumerize/predicates.rb
CHANGED
data/lib/enumerize/version.rb
CHANGED
@@ -61,7 +61,11 @@ RSpec.describe Enumerize::Integrations::RSpec::Matcher do
|
|
61
61
|
model.enumerize(:sex, :in => [:male, :female])
|
62
62
|
end
|
63
63
|
|
64
|
-
it 'accepts the right params as
|
64
|
+
it 'accepts the right params as an array' do
|
65
|
+
expect(subject).to enumerize(:sex).in([:male, :female])
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'accepts the right params as regular params' do
|
65
69
|
expect(subject).to enumerize(:sex).in(:male, :female)
|
66
70
|
end
|
67
71
|
|
@@ -90,7 +94,7 @@ RSpec.describe Enumerize::Integrations::RSpec::Matcher do
|
|
90
94
|
model.enumerize(:sex, :in => { male: 0, female: 1 })
|
91
95
|
end
|
92
96
|
|
93
|
-
it 'accepts the right params as
|
97
|
+
it 'accepts the right params as an array' do
|
94
98
|
expect(subject).to enumerize(:sex).in(:male, :female)
|
95
99
|
end
|
96
100
|
|
data/spec/spec_helper.rb
CHANGED
@@ -8,17 +8,21 @@ RSpec.configure do |config|
|
|
8
8
|
Kernel.srand config.seed
|
9
9
|
config.filter_run focus: true
|
10
10
|
config.run_all_when_everything_filtered = true
|
11
|
+
|
11
12
|
config.expect_with :rspec do |expectations|
|
12
13
|
expectations.syntax = :expect
|
13
14
|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
14
15
|
end
|
16
|
+
|
15
17
|
config.mock_with :rspec do |mocks|
|
16
18
|
mocks.syntax = :expect
|
17
19
|
mocks.verify_partial_doubles = true
|
18
20
|
end
|
21
|
+
|
19
22
|
if config.files_to_run.one?
|
20
23
|
config.default_formatter = 'doc'
|
21
24
|
end
|
25
|
+
|
22
26
|
config.warnings = true
|
23
27
|
config.include RSpec::Matchers::FailMatchers
|
24
28
|
end
|
data/test/mongoid_test.rb
CHANGED
@@ -7,9 +7,8 @@ silence_warnings do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
Mongoid.configure do |config|
|
10
|
-
config.
|
11
|
-
config.
|
12
|
-
config.include_root_in_json = true
|
10
|
+
config.connect_to('enumerize-test-suite')
|
11
|
+
config.options = { use_utc: true, include_root_in_json: true }
|
13
12
|
end
|
14
13
|
|
15
14
|
describe Enumerize do
|
data/test/predicates_test.rb
CHANGED
@@ -15,6 +15,12 @@ describe Enumerize::Predicates do
|
|
15
15
|
object.must_respond_to :b?
|
16
16
|
end
|
17
17
|
|
18
|
+
it 'creates predicate methods when enumerized values have dash in it' do
|
19
|
+
klass.enumerize(:foo, in: %w(foo-bar bar-foo), predicates: true)
|
20
|
+
object.must_respond_to :foo_bar?
|
21
|
+
object.must_respond_to :bar_foo?
|
22
|
+
end
|
23
|
+
|
18
24
|
it 'creates predicate methods on multiple attribute' do
|
19
25
|
klass.enumerize(:foo, in: %w(a b), predicates: true, multiple: true)
|
20
26
|
object.must_respond_to :a?
|
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: 1.1.
|
4
|
+
version: 1.1.1
|
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: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.4.
|
109
|
+
rubygems_version: 2.4.6
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: Enumerated attributes with I18n and ActiveRecord/Mongoid/MongoMapper support
|