managed_enum 0.0.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 +15 -0
- data/MIT-LICENSE +20 -0
- data/README.md +68 -0
- data/Rakefile +38 -0
- data/lib/managed_enum/has_managed_enum.rb +49 -0
- data/lib/managed_enum/version.rb +3 -0
- data/lib/managed_enum.rb +3 -0
- data/lib/tasks/managed_enum_tasks.rake +4 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/person.rb +6 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20150505210140_create_people.rb +11 -0
- data/test/dummy/db/schema.rb +24 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +128 -0
- data/test/dummy/log/test.log +135 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/people.yml +11 -0
- data/test/dummy/test/unit/person_test.rb +7 -0
- data/test/has_managed_enum_test.rb +48 -0
- data/test/managed_enum_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +159 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
7
|
+
div.dialog {
|
|
8
|
+
width: 25em;
|
|
9
|
+
padding: 0 4em;
|
|
10
|
+
margin: 4em auto 0 auto;
|
|
11
|
+
border: 1px solid #ccc;
|
|
12
|
+
border-right-color: #999;
|
|
13
|
+
border-bottom-color: #999;
|
|
14
|
+
}
|
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<!-- This file lives in public/500.html -->
|
|
21
|
+
<div class="dialog">
|
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
23
|
+
</div>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
|
6
|
+
require 'rails/commands'
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'managed_enum/has_managed_enum'
|
|
3
|
+
|
|
4
|
+
class HasManagedEnumTest < ActiveSupport::TestCase
|
|
5
|
+
test "truth" do
|
|
6
|
+
assert_kind_of Module, ManagedEnum::HasManagedEnum
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def test_person_possible_age_phase_values
|
|
10
|
+
age_phases = {baby: 10, child: 20, young: 30, man: 40, old: 50}
|
|
11
|
+
assert_equal age_phases, Person.age_phase_possible_keyvalues
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_person_possible_status_values
|
|
15
|
+
statuses = %w(employed self_employed entrepreneur unemployed)
|
|
16
|
+
assert_equal statuses, Person.status_possible_keyvalues
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_person_age_phase
|
|
20
|
+
age_phases = {baby: 10, child: 20, young: 30, man: 40, old: 50}
|
|
21
|
+
age_phases.each do |age_phase_name, age_phase_limit|
|
|
22
|
+
assert_equal age_phase_limit, Person.send(age_phase_name.upcase)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_person_age_phase
|
|
27
|
+
statuses = %w(employed self_employed entrepreneur unemployed)
|
|
28
|
+
statuses.each do |status|
|
|
29
|
+
assert_equal status, Person.send(status.upcase)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_a_person_should_become_a_baby
|
|
34
|
+
person = Person.new
|
|
35
|
+
assert_equal false, person.baby?
|
|
36
|
+
person.make_baby
|
|
37
|
+
assert_equal true, person.baby?
|
|
38
|
+
assert_equal 10, person.age_phase
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_a_person_should_become_an_unemployed
|
|
42
|
+
person = Person.new
|
|
43
|
+
assert_equal false, person.unemployed?
|
|
44
|
+
person.make_unemployed
|
|
45
|
+
assert_equal true, person.unemployed?
|
|
46
|
+
assert_equal 'unemployed', person.status
|
|
47
|
+
end
|
|
48
|
+
end
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Configure Rails Environment
|
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
|
3
|
+
|
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
5
|
+
require "rails/test_help"
|
|
6
|
+
|
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
|
8
|
+
|
|
9
|
+
# Load support files
|
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
11
|
+
|
|
12
|
+
# Load fixtures from the engine
|
|
13
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
|
14
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
|
15
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: managed_enum
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Maher El-Atawy
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rails
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 3.2.17
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 3.2.17
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: sqlite3
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ! '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ! '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: A management of enumerated fields in activerecord.
|
|
42
|
+
email:
|
|
43
|
+
- maher.atawy@accorpa.com
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- MIT-LICENSE
|
|
49
|
+
- README.md
|
|
50
|
+
- Rakefile
|
|
51
|
+
- lib/managed_enum.rb
|
|
52
|
+
- lib/managed_enum/has_managed_enum.rb
|
|
53
|
+
- lib/managed_enum/version.rb
|
|
54
|
+
- lib/tasks/managed_enum_tasks.rake
|
|
55
|
+
- test/dummy/README.rdoc
|
|
56
|
+
- test/dummy/Rakefile
|
|
57
|
+
- test/dummy/app/assets/javascripts/application.js
|
|
58
|
+
- test/dummy/app/assets/stylesheets/application.css
|
|
59
|
+
- test/dummy/app/controllers/application_controller.rb
|
|
60
|
+
- test/dummy/app/helpers/application_helper.rb
|
|
61
|
+
- test/dummy/app/models/person.rb
|
|
62
|
+
- test/dummy/app/views/layouts/application.html.erb
|
|
63
|
+
- test/dummy/config.ru
|
|
64
|
+
- test/dummy/config/application.rb
|
|
65
|
+
- test/dummy/config/boot.rb
|
|
66
|
+
- test/dummy/config/database.yml
|
|
67
|
+
- test/dummy/config/environment.rb
|
|
68
|
+
- test/dummy/config/environments/development.rb
|
|
69
|
+
- test/dummy/config/environments/production.rb
|
|
70
|
+
- test/dummy/config/environments/test.rb
|
|
71
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
72
|
+
- test/dummy/config/initializers/inflections.rb
|
|
73
|
+
- test/dummy/config/initializers/mime_types.rb
|
|
74
|
+
- test/dummy/config/initializers/secret_token.rb
|
|
75
|
+
- test/dummy/config/initializers/session_store.rb
|
|
76
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
|
77
|
+
- test/dummy/config/locales/en.yml
|
|
78
|
+
- test/dummy/config/routes.rb
|
|
79
|
+
- test/dummy/db/development.sqlite3
|
|
80
|
+
- test/dummy/db/migrate/20150505210140_create_people.rb
|
|
81
|
+
- test/dummy/db/schema.rb
|
|
82
|
+
- test/dummy/db/test.sqlite3
|
|
83
|
+
- test/dummy/log/development.log
|
|
84
|
+
- test/dummy/log/test.log
|
|
85
|
+
- test/dummy/public/404.html
|
|
86
|
+
- test/dummy/public/422.html
|
|
87
|
+
- test/dummy/public/500.html
|
|
88
|
+
- test/dummy/public/favicon.ico
|
|
89
|
+
- test/dummy/script/rails
|
|
90
|
+
- test/dummy/test/fixtures/people.yml
|
|
91
|
+
- test/dummy/test/unit/person_test.rb
|
|
92
|
+
- test/has_managed_enum_test.rb
|
|
93
|
+
- test/managed_enum_test.rb
|
|
94
|
+
- test/test_helper.rb
|
|
95
|
+
homepage: http://www.github.com/melatawy/managed_enum
|
|
96
|
+
licenses: []
|
|
97
|
+
metadata: {}
|
|
98
|
+
post_install_message:
|
|
99
|
+
rdoc_options: []
|
|
100
|
+
require_paths:
|
|
101
|
+
- lib
|
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ! '>='
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0'
|
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ! '>='
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
requirements: []
|
|
113
|
+
rubyforge_project:
|
|
114
|
+
rubygems_version: 2.4.6
|
|
115
|
+
signing_key:
|
|
116
|
+
specification_version: 4
|
|
117
|
+
summary: Managed Enumerated Fields in ActiveRecord
|
|
118
|
+
test_files:
|
|
119
|
+
- test/dummy/app/assets/javascripts/application.js
|
|
120
|
+
- test/dummy/app/assets/stylesheets/application.css
|
|
121
|
+
- test/dummy/app/controllers/application_controller.rb
|
|
122
|
+
- test/dummy/app/helpers/application_helper.rb
|
|
123
|
+
- test/dummy/app/models/person.rb
|
|
124
|
+
- test/dummy/app/views/layouts/application.html.erb
|
|
125
|
+
- test/dummy/config/application.rb
|
|
126
|
+
- test/dummy/config/boot.rb
|
|
127
|
+
- test/dummy/config/database.yml
|
|
128
|
+
- test/dummy/config/environment.rb
|
|
129
|
+
- test/dummy/config/environments/development.rb
|
|
130
|
+
- test/dummy/config/environments/production.rb
|
|
131
|
+
- test/dummy/config/environments/test.rb
|
|
132
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
133
|
+
- test/dummy/config/initializers/inflections.rb
|
|
134
|
+
- test/dummy/config/initializers/mime_types.rb
|
|
135
|
+
- test/dummy/config/initializers/secret_token.rb
|
|
136
|
+
- test/dummy/config/initializers/session_store.rb
|
|
137
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
|
138
|
+
- test/dummy/config/locales/en.yml
|
|
139
|
+
- test/dummy/config/routes.rb
|
|
140
|
+
- test/dummy/config.ru
|
|
141
|
+
- test/dummy/db/development.sqlite3
|
|
142
|
+
- test/dummy/db/migrate/20150505210140_create_people.rb
|
|
143
|
+
- test/dummy/db/schema.rb
|
|
144
|
+
- test/dummy/db/test.sqlite3
|
|
145
|
+
- test/dummy/log/development.log
|
|
146
|
+
- test/dummy/log/test.log
|
|
147
|
+
- test/dummy/public/404.html
|
|
148
|
+
- test/dummy/public/422.html
|
|
149
|
+
- test/dummy/public/500.html
|
|
150
|
+
- test/dummy/public/favicon.ico
|
|
151
|
+
- test/dummy/Rakefile
|
|
152
|
+
- test/dummy/README.rdoc
|
|
153
|
+
- test/dummy/script/rails
|
|
154
|
+
- test/dummy/test/fixtures/people.yml
|
|
155
|
+
- test/dummy/test/unit/person_test.rb
|
|
156
|
+
- test/has_managed_enum_test.rb
|
|
157
|
+
- test/managed_enum_test.rb
|
|
158
|
+
- test/test_helper.rb
|
|
159
|
+
has_rdoc:
|