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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 461b3c90498c65da6f580b4f0b2fd794eb28a832
4
- data.tar.gz: 02b9a83c3337c4af82268c9e2ed48b18dc23f217
3
+ metadata.gz: 78bc9a162cff923b835c2887e1722a4ec240c867
4
+ data.tar.gz: 2a618cd93d0e3e01439ff604a87aa6c6f2c0eb80
5
5
  SHA512:
6
- metadata.gz: 3c438e006bef648f25c0217a752d1a8b9d8057afd720e0580dc09d10321bb970a81bdc9c369a07b5637a7b12586abfb58559d021c8f3d3ff98bc0fa897546b93
7
- data.tar.gz: 4f8b082c843c9fbbbf27f36b39cc691c75984f13400bba0cf557a4a8c64b6a3a05cc69a46dd881241490ee519ebdb5dc60f15ebd070dde7825a62fdfa62a5c21
6
+ metadata.gz: cec7b51f1ebdacb68250cee5fae7b15e5d5bacbe487a4ecf78c065c5b3554b4bdca2651e5b1c87dd26d12361e6502a066749491935964cc657fad3a536323de4
7
+ data.tar.gz: 75b78af33ef1a4f4532e3f873e1e6fc1b1349a62bd6249535e8ee5822f6624d1dba5b1874124e9438f5456c294b703372ede1548fd0d2e73dd59a8a709f70761
@@ -2,9 +2,14 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.3
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
@@ -1,7 +1,9 @@
1
1
  # ClassyEnum Changelog
2
2
 
3
- ## 4.0.0 (Unreleased)
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://secure.travis-ci.org/beerlington/classy_enum.png?branch=master)](http://travis-ci.org/beerlington/classy_enum)
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.png)](https://codeclimate.com/github/beerlington/classy_enum)
6
- [![Dependency Status](https://gemnasium.com/beerlington/classy_enum.png)](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.1.x
14
+ *Rails:* 3.2.x - 4.2.x
15
15
 
16
- *Ruby:* 1.9.2, 1.9.3, 2.0.0 and 2.1.0
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.
@@ -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', '>= 2.11')
21
- gem.add_development_dependency('sqlite3', '>= 1.3')
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
@@ -1,6 +1,6 @@
1
1
  source :rubygems
2
2
 
3
- gem 'rails', '~> 4.2.0.beta'
3
+ gem 'rails', '~> 4.2.0'
4
4
  gem 'rspec-rails', '~> 2.11'
5
5
  gem 'sqlite3'
6
6
  gem 'json', '~> 1.7'
@@ -25,7 +25,11 @@ module ClassyEnum
25
25
  other = other.new
26
26
  end
27
27
 
28
- index <=> other.index
28
+ if other.is_a? ClassyEnum::Base
29
+ index <=> other.index
30
+ else
31
+ nil
32
+ end
29
33
  end
30
34
 
31
35
  def enum_options
@@ -1,3 +1,3 @@
1
1
  module ClassyEnum
2
- VERSION = "4.0.0.beta1"
2
+ VERSION = "4.0.0"
3
3
  end
@@ -40,6 +40,7 @@ describe ClassyEnum::Collection do
40
40
  its(:first) { should == 'one' }
41
41
  its(:first) { should_not == :two }
42
42
  its(:first) { should_not == :not_found }
43
+ its(:first) { should_not == String }
43
44
 
44
45
  its(:max) { should == :three }
45
46
  end
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.beta1
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-04 00:00:00.000000000 Z
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: '2.11'
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: '2.11'
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: 1.3.1
129
+ version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.2.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