classy_enum 4.0.0.beta1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/CHANGELOG.md +3 -1
- data/README.md +38 -5
- data/classy_enum.gemspec +2 -2
- data/gemfiles/Gemfile.rails-4.2.x +1 -1
- data/lib/classy_enum/collection.rb +5 -1
- data/lib/classy_enum/version.rb +1 -1
- data/spec/classy_enum/collection_spec.rb +1 -0
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78bc9a162cff923b835c2887e1722a4ec240c867
|
4
|
+
data.tar.gz: 2a618cd93d0e3e01439ff604a87aa6c6f2c0eb80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cec7b51f1ebdacb68250cee5fae7b15e5d5bacbe487a4ecf78c065c5b3554b4bdca2651e5b1c87dd26d12361e6502a066749491935964cc657fad3a536323de4
|
7
|
+
data.tar.gz: 75b78af33ef1a4f4532e3f873e1e6fc1b1349a62bd6249535e8ee5822f6624d1dba5b1874124e9438f5456c294b703372ede1548fd0d2e73dd59a8a709f70761
|
data/.travis.yml
CHANGED
@@ -2,9 +2,14 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 1.9.3
|
4
4
|
- 2.0.0
|
5
|
-
- 2.1.
|
5
|
+
- 2.1.5
|
6
|
+
- 2.2.0
|
6
7
|
gemfile:
|
7
8
|
- gemfiles/Gemfile.rails-3.2.x
|
8
9
|
- gemfiles/Gemfile.rails-4.0.x
|
9
10
|
- gemfiles/Gemfile.rails-4.1.x
|
10
11
|
- gemfiles/Gemfile.rails-4.2.x
|
12
|
+
matrix:
|
13
|
+
exclude:
|
14
|
+
- rvm: 2.2.0
|
15
|
+
gemfile: gemfiles/Gemfile.rails-3.2.x
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# ClassyEnum Changelog
|
2
2
|
|
3
|
-
## 4.0.0
|
3
|
+
## 4.0.0
|
4
4
|
|
5
|
+
* Adds support for Ruby 2.2.0
|
6
|
+
* Adds support for Rails 4.2.0
|
5
7
|
* [BREAKING] Removes support for Ruby 1.8.7
|
6
8
|
* [BREAKING] Removes support for Rails 3.0.x and 3.1.x
|
7
9
|
* [BREAKING] Active Record models must explicitly include ClassyEnum::ActiveRecord now
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# ClassyEnum
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://travis-ci.org/beerlington/classy_enum.svg?branch=master)](https://travis-ci.org/beerlington/classy_enum)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/classy_enum.png)](http://badge.fury.io/rb/classy_enum)
|
5
|
-
[![Code Climate](https://codeclimate.com/github/beerlington/classy_enum.
|
6
|
-
[![Dependency Status](https://gemnasium.com/beerlington/classy_enum.
|
5
|
+
[![Code Climate](https://codeclimate.com/github/beerlington/classy_enum/badges/gpa.svg)](https://codeclimate.com/github/beerlington/classy_enum)
|
6
|
+
[![Dependency Status](https://gemnasium.com/beerlington/classy_enum.svg)](https://gemnasium.com/beerlington/classy_enum)
|
7
7
|
|
8
8
|
ClassyEnum is a Ruby on Rails gem that adds class-based enumerator functionality to Active Record attributes.
|
9
9
|
|
@@ -11,9 +11,9 @@ This README is also available in a [user-friendly DocumentUp format](http://beer
|
|
11
11
|
|
12
12
|
## Rails & Ruby Versions Supported
|
13
13
|
|
14
|
-
*Rails:* 3.2.x - 4.
|
14
|
+
*Rails:* 3.2.x - 4.2.x
|
15
15
|
|
16
|
-
*Ruby:* 1.9.
|
16
|
+
*Ruby:* 1.9.3, 2.0.0, 2.1.x, and 2.2.x
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
@@ -334,6 +334,39 @@ that can be used by Rails' form builders such as SimpleForm and Formtastic.
|
|
334
334
|
<% end %>
|
335
335
|
```
|
336
336
|
|
337
|
+
## Testing Enums
|
338
|
+
|
339
|
+
ClassyEnums can be tested by creating new instances of the ClassyEnum and
|
340
|
+
testing expectations. For example:
|
341
|
+
|
342
|
+
``` ruby
|
343
|
+
class TestPriorityHigh < Minitest::Test
|
344
|
+
def setup
|
345
|
+
@priority_high_enum = Priority::High.new
|
346
|
+
end
|
347
|
+
|
348
|
+
def test_send_email_enabled
|
349
|
+
assert @priority_high_enum.send_email?
|
350
|
+
end
|
351
|
+
end
|
352
|
+
```
|
353
|
+
|
354
|
+
If the ClassyEnum method implementations rely upon the owner, the
|
355
|
+
`ClassyEnum#build` method can be used with the `owner` option. For example:
|
356
|
+
|
357
|
+
``` ruby
|
358
|
+
class TestPriorityHigh < Minitest::Test
|
359
|
+
def setup
|
360
|
+
@alarm = Alarm.create
|
361
|
+
@priority_high_enum = Priority::High.build(:high, owner: @alarm)
|
362
|
+
end
|
363
|
+
|
364
|
+
def test_send_email_enabled
|
365
|
+
assert_equal @priority_high_enum.owner, @alarm
|
366
|
+
end
|
367
|
+
end
|
368
|
+
```
|
369
|
+
|
337
370
|
## Copyright
|
338
371
|
|
339
372
|
Copyright (c) 2010-2014 [Peter Brown](https://github.com/beerlington). See LICENSE for details.
|
data/classy_enum.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.add_dependency('activerecord', '>= 3.2')
|
19
19
|
|
20
|
-
gem.add_development_dependency('rspec', '
|
21
|
-
gem.add_development_dependency('sqlite3', '
|
20
|
+
gem.add_development_dependency('rspec', '~> 2.11.0')
|
21
|
+
gem.add_development_dependency('sqlite3', '~> 1.3')
|
22
22
|
gem.add_development_dependency('json', '>= 1.6')
|
23
23
|
|
24
24
|
end
|
data/lib/classy_enum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classy_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Brown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -28,28 +28,28 @@ dependencies:
|
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.11.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.11.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sqlite3
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -124,12 +124,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - "
|
127
|
+
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
129
|
+
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.4.5
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: A class based enumerator utility for Ruby on Rails
|