average_roles 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/config/initializers/average_roles.rb +8 -0
- data/lib/average_roles.rb +25 -0
- data/lib/average_roles/engine.rb +4 -0
- data/lib/average_roles/models/concerns/role.rb +22 -0
- data/lib/average_roles/models/concerns/user.rb +130 -0
- data/lib/average_roles/version.rb +3 -0
- data/lib/tasks/average_roles_tasks.rake +4 -0
- data/test/average_roles_test.rb +7 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/role.rb +3 -0
- data/test/dummy/app/models/user.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +24 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +89 -0
- data/test/dummy/config/database.yml.travis +4 -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 +78 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/average_roles.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/migrate/20140929035502_create_users.rb +9 -0
- data/test/dummy/db/migrate/20140929035606_create_roles.rb +13 -0
- data/test/dummy/db/migrate/20140929070323_create_roles_users.rb +8 -0
- data/test/dummy/db/schema.rb +34 -0
- data/test/dummy/log/development.log +15 -0
- data/test/dummy/log/test.log +18907 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/fixtures/roles.yml +37 -0
- data/test/dummy/test/fixtures/users.yml +16 -0
- data/test/dummy/test/models/role_test.rb +81 -0
- data/test/dummy/test/models/user_test.rb +184 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +46 -0
- metadata +196 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
# Configure Rails Environment
|
5
|
+
ENV["RAILS_ENV"] = "test"
|
6
|
+
|
7
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
8
|
+
require "rails/test_help"
|
9
|
+
|
10
|
+
Rails.backtrace_cleaner.remove_silencers!
|
11
|
+
|
12
|
+
# Load support files
|
13
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
|
+
|
15
|
+
# Load fixtures from the engine
|
16
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
17
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Below for issue: can't use fixtures with a created engine #4971
|
21
|
+
# https://github.com/rails/rails/issues/4971
|
22
|
+
|
23
|
+
# Drop all tables
|
24
|
+
ActiveRecord::Base.establish_connection
|
25
|
+
ActiveRecord::Base.connection.execute("drop schema public cascade;")
|
26
|
+
ActiveRecord::Base.connection.execute("create schema public;")
|
27
|
+
|
28
|
+
# Run any available migration (part of issue above but test db isn't migrating...)
|
29
|
+
# Should just load schema but haven't looked up how to do that.
|
30
|
+
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
31
|
+
|
32
|
+
# I had to add in /dummy/test to the path to find the fixtures correcty.
|
33
|
+
# No one else had mentioned this but it works for me.
|
34
|
+
# I guess this is because I have my tests and fixtures in the dummy app in the first place.
|
35
|
+
# I could move them out and put them in the gem root, but I feel they belong in the test app?
|
36
|
+
# Perhaps ultimately they dont, but they rely on the test app and don't test the gem
|
37
|
+
# independently of the test app so I'm not sure!
|
38
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../dummy/test/fixtures", __FILE__)
|
39
|
+
|
40
|
+
# Save me manually doing this in every test case
|
41
|
+
class ActiveSupport::TestCase
|
42
|
+
fixtures :all
|
43
|
+
end
|
44
|
+
|
45
|
+
# Other issues if using a mountable engine around namespaces can also be resolved
|
46
|
+
# with information in the above github issue.
|
metadata
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: average_roles
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dyson Simmons
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-03 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: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: postgres_tree
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Add roles to models with tree structure via postgres_tree. It's average
|
56
|
+
because it doesn't do much else.
|
57
|
+
email:
|
58
|
+
- dysonsimmons@gmail.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- MIT-LICENSE
|
64
|
+
- Rakefile
|
65
|
+
- config/initializers/average_roles.rb
|
66
|
+
- lib/average_roles.rb
|
67
|
+
- lib/average_roles/engine.rb
|
68
|
+
- lib/average_roles/models/concerns/role.rb
|
69
|
+
- lib/average_roles/models/concerns/user.rb
|
70
|
+
- lib/average_roles/version.rb
|
71
|
+
- lib/tasks/average_roles_tasks.rake
|
72
|
+
- test/average_roles_test.rb
|
73
|
+
- test/dummy/README.rdoc
|
74
|
+
- test/dummy/Rakefile
|
75
|
+
- test/dummy/app/assets/javascripts/application.js
|
76
|
+
- test/dummy/app/assets/stylesheets/application.css
|
77
|
+
- test/dummy/app/controllers/application_controller.rb
|
78
|
+
- test/dummy/app/helpers/application_helper.rb
|
79
|
+
- test/dummy/app/models/role.rb
|
80
|
+
- test/dummy/app/models/user.rb
|
81
|
+
- test/dummy/app/views/layouts/application.html.erb
|
82
|
+
- test/dummy/bin/bundle
|
83
|
+
- test/dummy/bin/rails
|
84
|
+
- test/dummy/bin/rake
|
85
|
+
- test/dummy/config.ru
|
86
|
+
- test/dummy/config/application.rb
|
87
|
+
- test/dummy/config/boot.rb
|
88
|
+
- test/dummy/config/database.yml
|
89
|
+
- test/dummy/config/database.yml.travis
|
90
|
+
- test/dummy/config/environment.rb
|
91
|
+
- test/dummy/config/environments/development.rb
|
92
|
+
- test/dummy/config/environments/production.rb
|
93
|
+
- test/dummy/config/environments/test.rb
|
94
|
+
- test/dummy/config/initializers/assets.rb
|
95
|
+
- test/dummy/config/initializers/average_roles.rb
|
96
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
97
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
98
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
99
|
+
- test/dummy/config/initializers/inflections.rb
|
100
|
+
- test/dummy/config/initializers/mime_types.rb
|
101
|
+
- test/dummy/config/initializers/session_store.rb
|
102
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
103
|
+
- test/dummy/config/locales/en.yml
|
104
|
+
- test/dummy/config/routes.rb
|
105
|
+
- test/dummy/config/secrets.yml
|
106
|
+
- test/dummy/db/migrate/20140929035502_create_users.rb
|
107
|
+
- test/dummy/db/migrate/20140929035606_create_roles.rb
|
108
|
+
- test/dummy/db/migrate/20140929070323_create_roles_users.rb
|
109
|
+
- test/dummy/db/schema.rb
|
110
|
+
- test/dummy/log/development.log
|
111
|
+
- test/dummy/log/test.log
|
112
|
+
- test/dummy/public/404.html
|
113
|
+
- test/dummy/public/422.html
|
114
|
+
- test/dummy/public/500.html
|
115
|
+
- test/dummy/public/favicon.ico
|
116
|
+
- test/dummy/test/fixtures/roles.yml
|
117
|
+
- test/dummy/test/fixtures/users.yml
|
118
|
+
- test/dummy/test/models/role_test.rb
|
119
|
+
- test/dummy/test/models/user_test.rb
|
120
|
+
- test/integration/navigation_test.rb
|
121
|
+
- test/test_helper.rb
|
122
|
+
homepage: https://github.com/dyson/average_roles
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.2.2
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Rails 4 roles based on a tree structure.
|
146
|
+
test_files:
|
147
|
+
- test/average_roles_test.rb
|
148
|
+
- test/integration/navigation_test.rb
|
149
|
+
- test/test_helper.rb
|
150
|
+
- test/dummy/README.rdoc
|
151
|
+
- test/dummy/db/migrate/20140929035502_create_users.rb
|
152
|
+
- test/dummy/db/migrate/20140929070323_create_roles_users.rb
|
153
|
+
- test/dummy/db/migrate/20140929035606_create_roles.rb
|
154
|
+
- test/dummy/db/schema.rb
|
155
|
+
- test/dummy/test/fixtures/users.yml
|
156
|
+
- test/dummy/test/fixtures/roles.yml
|
157
|
+
- test/dummy/test/models/user_test.rb
|
158
|
+
- test/dummy/test/models/role_test.rb
|
159
|
+
- test/dummy/app/controllers/application_controller.rb
|
160
|
+
- test/dummy/app/views/layouts/application.html.erb
|
161
|
+
- test/dummy/app/assets/stylesheets/application.css
|
162
|
+
- test/dummy/app/assets/javascripts/application.js
|
163
|
+
- test/dummy/app/helpers/application_helper.rb
|
164
|
+
- test/dummy/app/models/user.rb
|
165
|
+
- test/dummy/app/models/role.rb
|
166
|
+
- test/dummy/config.ru
|
167
|
+
- test/dummy/log/development.log
|
168
|
+
- test/dummy/log/test.log
|
169
|
+
- test/dummy/public/404.html
|
170
|
+
- test/dummy/public/favicon.ico
|
171
|
+
- test/dummy/public/422.html
|
172
|
+
- test/dummy/public/500.html
|
173
|
+
- test/dummy/bin/rails
|
174
|
+
- test/dummy/bin/bundle
|
175
|
+
- test/dummy/bin/rake
|
176
|
+
- test/dummy/Rakefile
|
177
|
+
- test/dummy/config/application.rb
|
178
|
+
- test/dummy/config/database.yml.travis
|
179
|
+
- test/dummy/config/environment.rb
|
180
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
181
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
182
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
183
|
+
- test/dummy/config/initializers/average_roles.rb
|
184
|
+
- test/dummy/config/initializers/session_store.rb
|
185
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
186
|
+
- test/dummy/config/initializers/mime_types.rb
|
187
|
+
- test/dummy/config/initializers/assets.rb
|
188
|
+
- test/dummy/config/initializers/inflections.rb
|
189
|
+
- test/dummy/config/environments/production.rb
|
190
|
+
- test/dummy/config/environments/test.rb
|
191
|
+
- test/dummy/config/environments/development.rb
|
192
|
+
- test/dummy/config/secrets.yml
|
193
|
+
- test/dummy/config/database.yml
|
194
|
+
- test/dummy/config/routes.rb
|
195
|
+
- test/dummy/config/boot.rb
|
196
|
+
- test/dummy/config/locales/en.yml
|