rolify 3.3.0.rc4 → 3.3.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: adb734bf9468069dbead78c35683ac1ace1525d8
4
+ data.tar.gz: b4a221f3435dda2c84ccccf7086bc4a41eadda8d
5
+ SHA512:
6
+ metadata.gz: 7168a6699067f23cf85cb6b74b599a043e26720be10c9746e7910cc7cbdc296b5d9ffe5922ea2d8484167ccb3c9c6ce6c347efddb20c14c7d843791d0f186e52
7
+ data.tar.gz: 2f701c24d16d9dccbac72a270a93f9cd6e470dd60584c548812a97a09458b75f00829d5b0320ae3ab080d123c713c2c5ad32282b4c615b8ebf11e672dd576de9
data/.gitignore CHANGED
@@ -4,6 +4,7 @@ Gemfile.lock
4
4
  gemfiles/*.lock
5
5
  pkg/*
6
6
  tmp/*
7
+ coverage/*
7
8
  log*/*
8
9
  .rbx/*
9
10
  .rspec
data/.travis.yml CHANGED
@@ -15,9 +15,3 @@ env:
15
15
  services: mongodb
16
16
 
17
17
  before_script: rails --version
18
-
19
- matrix:
20
- allow_failures:
21
- - rvm: rbx-19mode
22
- - rvm: jruby-19mode
23
- - gemfile: gemfiles/Gemfile.rails-4.0
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  case ENV["ADAPTER"]
4
4
  when nil, "active_record"
5
5
  group :test do
6
- gem "activerecord-jdbcsqlite3-adapter", :platform => "jruby"
6
+ gem "activerecord-jdbcsqlite3-adapter", ">= 1.3.0.rc", :platform => "jruby"
7
7
  gem "sqlite3", :platform => "ruby"
8
8
  end
9
9
  gem "activerecord", ">= 3.2.0", :require => "active_record"
@@ -14,4 +14,8 @@ else
14
14
  raise "Unknown model adapter: #{ENV["ADAPTER"]}"
15
15
  end
16
16
 
17
+ group :test do
18
+ gem 'coveralls', :require => false
19
+ end
20
+
17
21
  gemspec
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # rolify [![Gem Version](https://badge.fury.io/rb/rolify.png)](http://badge.fury.io/rb/rolify) [![build status](https://secure.travis-ci.org/EppO/rolify.png)](http://travis-ci.org/EppO/rolify) [![dependency status](https://gemnasium.com/EppO/rolify.png)](https://gemnasium.com/EppO/rolify) [![Code Climate](https://codeclimate.com/github/EppO/rolify.png)](https://codeclimate.com/github/EppO/rolify)
1
+ # rolify [![Gem Version](https://badge.fury.io/rb/rolify.png)](http://badge.fury.io/rb/rolify) [![build status](https://secure.travis-ci.org/EppO/rolify.png)](http://travis-ci.org/EppO/rolify) [![dependency status](https://gemnasium.com/EppO/rolify.png)](https://gemnasium.com/EppO/rolify) [![Code Climate](https://codeclimate.com/github/EppO/rolify.png)](https://codeclimate.com/github/EppO/rolify) [![Coverage Status](https://coveralls.io/repos/EppO/rolify/badge.png?branch=master)](https://coveralls.io/r/EppO/rolify)
2
+
2
3
 
3
4
  Very simple Roles library without any authorization enforcement supporting scope on resource object.
4
5
 
@@ -25,7 +26,7 @@ This library can be easily integrated with any authentication gem ([devise](http
25
26
  In <b>Rails 3</b>, add this to your Gemfile and run the +bundle+ command.
26
27
 
27
28
  ```ruby
28
- gem "rolify"
29
+ gem "rolify"
29
30
  ```
30
31
 
31
32
  ## Getting Started
@@ -35,7 +36,13 @@ In <b>Rails 3</b>, add this to your Gemfile and run the +bundle+ command.
35
36
  First, create your Role model and migration file using this generator:
36
37
 
37
38
  ```
38
- rails g rolify Role User
39
+ rails g rolify Role User
40
+ ```
41
+
42
+ **NB** for versions of Rolify prior to 3.3, use:
43
+
44
+ ```
45
+ rails g rolify:role Role User
39
46
  ```
40
47
 
41
48
  Role and User classes are the default. You can specify any Role class name you want. This is completly a new file so any name can do the job.
@@ -48,7 +55,7 @@ If you want to use Mongoid instead of ActiveRecord, just add `--orm=mongoid` arg
48
55
  Let's migrate !
49
56
 
50
57
  ```
51
- rake db:migrate
58
+ rake db:migrate
52
59
  ```
53
60
 
54
61
  ### 3.1 Configure your user model
@@ -56,13 +63,13 @@ Let's migrate !
56
63
  This gem adds the `rolify` method to your User class. You can also specify optional callbacks on the User class for when roles are added or removed:
57
64
 
58
65
  ```ruby
59
- class User < ActiveRecord::Base
60
- rolify :before_add => :before_add_method
66
+ class User < ActiveRecord::Base
67
+ rolify :before_add => :before_add_method
61
68
 
62
- def before_add_method(role)
63
- # do something before it gets added
64
- end
69
+ def before_add_method(role)
70
+ # do something before it gets added
65
71
  end
72
+ end
66
73
  ```
67
74
 
68
75
  The `rolify` method accepts the following callback options:
@@ -90,22 +97,22 @@ end
90
97
  To define a global role:
91
98
 
92
99
  ```ruby
93
- user = User.find(1)
94
- user.add_role :admin
100
+ user = User.find(1)
101
+ user.add_role :admin
95
102
  ```
96
103
 
97
104
  To define a role scoped to a resource instance
98
105
 
99
106
  ```ruby
100
- user = User.find(2)
101
- user.add_role :moderator, Forum.first
107
+ user = User.find(2)
108
+ user.add_role :moderator, Forum.first
102
109
  ```
103
110
 
104
111
  To define a role scoped to a resource class
105
112
 
106
113
  ```ruby
107
- user = User.find(3)
108
- user.add_role :moderator, Forum
114
+ user = User.find(3)
115
+ user.add_role :moderator, Forum
109
116
  ```
110
117
 
111
118
  That's it !
@@ -115,45 +122,45 @@ That's it !
115
122
  To check if a user has a global role:
116
123
 
117
124
  ```ruby
118
- user = User.find(1)
119
- user.add_role :admin # sets a global role
120
- user.has_role? :admin
121
- => true
125
+ user = User.find(1)
126
+ user.add_role :admin # sets a global role
127
+ user.has_role? :admin
128
+ => true
122
129
  ```
123
130
 
124
131
  To check if a user has a role scoped to a resource instance:
125
132
 
126
133
  ```ruby
127
- user = User.find(2)
128
- user.add_role :moderator, Forum.first # sets a role scoped to a resource instance
129
- user.has_role? :moderator, Forum.first
130
- => true
131
- user.has_role? :moderator, Forum.last
132
- => false
134
+ user = User.find(2)
135
+ user.add_role :moderator, Forum.first # sets a role scoped to a resource instance
136
+ user.has_role? :moderator, Forum.first
137
+ => true
138
+ user.has_role? :moderator, Forum.last
139
+ => false
133
140
  ```
134
141
 
135
142
  To check if a user has a role scoped to a resource class:
136
143
 
137
144
  ```ruby
138
- user = User.find(3)
139
- user.add_role :moderator, Forum # sets a role scoped to a resource class
140
- user.has_role? :moderator, Forum
141
- => true
142
- user.has_role? :moderator, Forum.first
143
- => true
144
- user.has_role? :moderator, Forum.last
145
- => true
145
+ user = User.find(3)
146
+ user.add_role :moderator, Forum # sets a role scoped to a resource class
147
+ user.has_role? :moderator, Forum
148
+ => true
149
+ user.has_role? :moderator, Forum.first
150
+ => true
151
+ user.has_role? :moderator, Forum.last
152
+ => true
146
153
  ```
147
154
 
148
155
  A global role overrides resource role request:
149
156
 
150
157
  ```ruby
151
- user = User.find(4)
152
- user.add_role :moderator # sets a global role
153
- user.has_role? :moderator, Forum.first
154
- => true
155
- user.has_role? :moderator, Forum.last
156
- => true
158
+ user = User.find(4)
159
+ user.add_role :moderator # sets a global role
160
+ user.has_role? :moderator, Forum.first
161
+ => true
162
+ user.has_role? :moderator, Forum.last
163
+ => true
157
164
  ```
158
165
 
159
166
  ### 6. Resource roles querying
@@ -163,27 +170,30 @@ Starting from rolify 3.0, you can search roles on instance level or class level
163
170
  #### Instance level
164
171
 
165
172
  ```ruby
166
- forum = Forum.first
167
- forum.roles
168
- # => [ list of roles that are only binded to forum instance ]
169
- forum.applied_roles
170
- # => [ list of roles binded to forum instance and to the Forum class ]
173
+ forum = Forum.first
174
+ forum.roles
175
+ # => [ list of roles that are only binded to forum instance ]
176
+ forum.applied_roles
177
+ # => [ list of roles binded to forum instance and to the Forum class ]
171
178
  ```
172
179
 
173
180
  #### Class level
174
181
 
175
182
  ```ruby
176
- Forum.with_role(:admin)
177
- # => [ list of Forum instances that has role "admin" binded to it ]
178
- Forum.with_role(:admin, current_user)
179
- # => [ list of Forum instances that has role "admin" binded to it and belongs to current_user roles ]
180
-
181
- Forum.find_roles
182
- # => [ list of roles that binded to any Forum instance or to the Forum class ]
183
- Forum.find_roles(:admin)
184
- # => [ list of roles that binded to any Forum instance or to the Forum class with "admin" as a role name ]
185
- Forum.find_roles(:admin, current_user)
186
- # => [ list of roles that binded to any Forum instance or to the Forum class with "admin" as a role name and belongs to current_user roles ]
183
+ Forum.with_role(:admin)
184
+ # => [ list of Forum instances that has role "admin" binded to it ]
185
+ Forum.with_role(:admin, current_user)
186
+ # => [ list of Forum instances that has role "admin" binded to it and belongs to current_user roles ]
187
+
188
+ User.with_any_role(:user, :admin)
189
+ # => [ list of User instances that has role "admin" or "user" binded to it ]
190
+
191
+ Forum.find_roles
192
+ # => [ list of roles that binded to any Forum instance or to the Forum class ]
193
+ Forum.find_roles(:admin)
194
+ # => [ list of roles that binded to any Forum instance or to the Forum class with "admin" as a role name ]
195
+ Forum.find_roles(:admin, current_user)
196
+ # => [ list of roles that binded to any Forum instance or to the Forum class with "admin" as a role name and belongs to current_user roles ]
187
197
  ```
188
198
 
189
199
  ## Resources
@@ -199,8 +209,12 @@ Starting from rolify 3.0, you can search roles on instance level or class level
199
209
 
200
210
  Please read the [upgrade instructions](UPGRADE.rdoc).
201
211
 
212
+ ## Known issues
213
+
214
+ If you are using Mongoid and/or less-rails gem, please read [this](https://github.com/EppO/rolify/wiki/FAQ#when-i-start-rails-using-server-console-whatever-i-get-this-error)
215
+
202
216
  ## Questions or Problems?
203
217
 
204
- If you have any issue or feature request with/for rolify, please add an [issue on GitHub](https://github.com/EppO/rolify/issues) or fork the project and send a pull request.
218
+ If you have any issue or feature request with/for rolify, please create an new [issue on GitHub](https://github.com/EppO/rolify/issues) **specifying the ruby runtime, rails and rolify versions you're using and the gems listed in your Gemfile**, or fork the project and send a pull request.
205
219
 
206
220
  To get the specs running you should call `bundle` and then `rake`. See the spec/README for more information.
data/Rakefile CHANGED
@@ -1,8 +1,11 @@
1
1
  require 'bundler'
2
2
  require 'rspec/core/rake_task'
3
+ require 'coveralls/rake/task'
3
4
 
4
5
  Bundler::GemHelper.install_tasks
5
6
 
7
+ Coveralls::RakeTask.new
8
+
6
9
  RSpec::Core::RakeTask.new(:generators) do |task|
7
10
  task.pattern = "spec/generators/**/*_spec.rb"
8
11
  end
@@ -11,7 +14,7 @@ RSpec::Core::RakeTask.new(:rolify) do |task|
11
14
  task.pattern = "spec/rolify/**/*_spec.rb"
12
15
  end
13
16
 
14
- task :default => :spec
17
+ task :default => [ :spec, 'coveralls:push' ]
15
18
 
16
19
  desc "Run all specs"
17
20
  task "spec" do
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  case ENV["ADAPTER"]
4
4
  when nil, "active_record"
5
5
  group :test do
6
- gem "activerecord-jdbcsqlite3-adapter", :platform => "jruby"
6
+ gem "activerecord-jdbcsqlite3-adapter", ">= 1.3.0.rc", :platform => "jruby"
7
7
  gem "sqlite3", :platform => "ruby"
8
8
  end
9
9
  gem "activerecord", "~> 3.2.0", :require => "active_record"
@@ -14,4 +14,8 @@ else
14
14
  raise "Unknown model adapter: #{ENV["ADAPTER"]}"
15
15
  end
16
16
 
17
+ group :test do
18
+ gem 'coveralls', :require => false
19
+ end
20
+
17
21
  gemspec :path => '../'
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  case ENV["ADAPTER"]
4
4
  when nil, "active_record"
5
- gem "activerecord", "~> 4.0.0.beta1", :require => "active_record"
5
+ gem "activerecord", "~> 4.0.0.rc", :require => "active_record"
6
6
  when "mongoid"
7
7
  gem "mongoid", :git => "git://github.com/mongoid/mongoid.git"
8
8
  gem "bson_ext", :platform => "ruby"
@@ -11,7 +11,7 @@ else
11
11
  end
12
12
 
13
13
  group :test do
14
- gem "rails", "~> 4.0.0.beta1"
14
+ gem "rails", "~> 4.0.0.rc"
15
15
  gem "ammeter"
16
16
  gem "rake"
17
17
  gem "rspec"
@@ -19,8 +19,9 @@ group :test do
19
19
  gem "fuubar"
20
20
  gem "bundler"
21
21
 
22
- gem "activerecord-jdbcsqlite3-adapter", :platform => "jruby"
22
+ gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.0.beta", :platform => "jruby"
23
23
  gem "sqlite3", :platform => "ruby"
24
- gem "activerecord", "~> 4.0.0.beta1", :require => "active_record"
24
+ gem "activerecord", "~> 4.0.0.rc", :require => "active_record"
25
25
  gem "mongoid", :git => "git://github.com/mongoid/mongoid.git"
26
+ gem 'coveralls', :require => false
26
27
  end
@@ -44,7 +44,7 @@ module Mongoid
44
44
 
45
45
  scopify
46
46
  RUBY
47
- content % { :user_cname => user_cname.constantize.table_name }
47
+ content % { :user_cname => user_cname.constantize.collection_name }
48
48
  end
49
49
  end
50
50
  end
@@ -4,7 +4,7 @@ An initializer file has been created here: config/initializers/rolify.rb, you
4
4
  can change rolify settings to match your needs.
5
5
  Defaults values are commented out.
6
6
 
7
- A Role class has been been created in app/models (with the name you gave as
7
+ A Role class has been created in app/models (with the name you gave as
8
8
  argument otherwise the default is role.rb), you can add your own business logic
9
9
  inside.
10
10
 
data/lib/rolify.rb CHANGED
@@ -9,19 +9,22 @@ require 'rolify/adapters/base'
9
9
  module Rolify
10
10
  extend Configure
11
11
 
12
- attr_accessor :role_cname, :adapter, :role_table_name
12
+ attr_accessor :role_cname, :adapter, :role_join_table_name, :role_table_name
13
13
 
14
14
  def rolify(options = {})
15
15
  include Role
16
16
  extend Dynamic if Rolify.dynamic_shortcuts
17
-
17
+
18
18
  options.reverse_merge!({:role_cname => 'Role'})
19
19
  self.role_cname = options[:role_cname]
20
20
  self.role_table_name = self.role_cname.tableize.gsub(/\//, "_")
21
21
 
22
- join_table = "#{self.to_s.tableize.gsub(/\//, "_")}_#{self.role_table_name}"
22
+ default_join_table = "#{self.to_s.tableize.gsub(/\//, "_")}_#{self.role_table_name}"
23
+ options.reverse_merge!({:role_join_table_name => default_join_table})
24
+ self.role_join_table_name = options[:role_join_table_name]
25
+
23
26
  rolify_options = { :class_name => options[:role_cname].camelize }
24
- rolify_options.merge!({ :join_table => join_table }) if Rolify.orm == "active_record"
27
+ rolify_options.merge!({ :join_table => self.role_join_table_name }) if Rolify.orm == "active_record"
25
28
  rolify_options.merge!(options.reject{ |k,v| ![ :before_add, :after_add, :before_remove, :after_remove ].include? k.to_sym })
26
29
 
27
30
  has_and_belongs_to_many :roles, rolify_options
@@ -32,22 +35,22 @@ module Rolify
32
35
 
33
36
  def resourcify(association_name = :roles, options = {})
34
37
  include Resource
35
-
38
+
36
39
  options.reverse_merge!({ :role_cname => 'Role', :dependent => :destroy })
37
40
  resourcify_options = { :class_name => options[:role_cname].camelize, :as => :resource, :dependent => options[:dependent] }
38
41
  self.role_cname = options[:role_cname]
39
42
  self.role_table_name = self.role_cname.tableize.gsub(/\//, "_")
40
43
 
41
44
  has_many association_name, resourcify_options
42
-
45
+
43
46
  self.adapter = Rolify::Adapter::Base.create("resource_adapter", self.role_cname, self.name)
44
47
  end
45
-
48
+
46
49
  def scopify
47
50
  require "rolify/adapters/#{Rolify.orm}/scopes.rb"
48
- extend Rolify::Adapter::Scopes
51
+ extend Rolify::Adapter::Scopes
49
52
  end
50
-
53
+
51
54
  def role_class
52
55
  self.role_cname.constantize
53
56
  end
@@ -7,6 +7,7 @@ module Rolify
7
7
  resources = relation.joins("INNER JOIN #{quote(roles_table)} ON #{quote(roles_table)}.resource_type = '#{relation.to_s}' AND
8
8
  (#{quote(roles_table)}.resource_id IS NULL OR #{quote(roles_table)}.resource_id = #{quote(relation.table_name)}.#{relation.primary_key})")
9
9
  resources = resources.where("#{quote(roles_table)}.name IN (?) AND #{quote(roles_table)}.resource_type = ?", Array(role_name), relation.to_s)
10
+ resources = resources.select("#{quote(relation.table_name)}.*")
10
11
  resources
11
12
  end
12
13
 
@@ -35,7 +35,11 @@ module Rolify
35
35
  end
36
36
 
37
37
  def scope(relation, conditions)
38
- query = relation.scoped
38
+ if Rails.version < "4.0"
39
+ query = relation.scoped
40
+ else
41
+ query = relation.all
42
+ end
39
43
  query = query.joins(:roles)
40
44
  query = where(query, conditions)
41
45
  query
@@ -3,7 +3,7 @@ require 'rails'
3
3
 
4
4
  module Rolify
5
5
  class Railtie < Rails::Railtie
6
- initializer 'rolify.initialize' do
6
+ initializer 'rolify.initialize', :after do
7
7
  ActiveSupport.on_load(:active_record) do
8
8
  ActiveRecord::Base.send :extend, Rolify
9
9
  end
data/lib/rolify/role.rb CHANGED
@@ -64,11 +64,9 @@ module Rolify
64
64
 
65
65
  def method_missing(method, *args, &block)
66
66
  if method.to_s.match(/^is_(\w+)_of[?]$/) || method.to_s.match(/^is_(\w+)[?]$/)
67
- if self.class.role_class.where(:name => $1).count > 0
68
- resource = args.first
69
- self.class.define_dynamic_method $1, resource
70
- return has_role?("#{$1}", resource)
71
- end
67
+ resource = args.first
68
+ self.class.define_dynamic_method $1, resource
69
+ return has_role?("#{$1}", resource)
72
70
  end unless !Rolify.dynamic_shortcuts
73
71
  super
74
72
  end
@@ -1,3 +1,3 @@
1
1
  module Rolify
2
- VERSION = "3.3.0.rc4"
2
+ VERSION = "3.3.0"
3
3
  end
@@ -1,9 +1,10 @@
1
1
  require 'generators_helper'
2
2
 
3
+ require 'rails/all'
3
4
  # Generators are not automatically loaded by Rails
4
5
  require 'generators/rolify/rolify_generator'
5
6
 
6
- describe Rolify::Generators::RolifyGenerator do
7
+ describe Rolify::Generators::RolifyGenerator, :if => ENV['ADAPTER'] == 'active_record' do
7
8
  # Tell the generator where to put its output (what it thinks of as Rails.root)
8
9
  destination File.expand_path("../../../../tmp", __FILE__)
9
10
  teardown :cleanup_destination_root
@@ -22,10 +23,10 @@ describe Rolify::Generators::RolifyGenerator do
22
23
  before {
23
24
  capture(:stdout) {
24
25
  generator.create_file "app/models/user.rb" do
25
- <<-RUBY
26
- class User < ActiveRecord::Base
27
- end
28
- RUBY
26
+ <<-RUBY
27
+ class User < ActiveRecord::Base
28
+ end
29
+ RUBY
29
30
  end
30
31
  }
31
32
  require File.join(destination_root, "app/models/user.rb")
@@ -114,13 +115,13 @@ RUBY
114
115
  before {
115
116
  capture(:stdout) {
116
117
  generator.create_file "app/models/admin/user.rb" do
117
- <<-RUBY
118
- module Admin
119
- class User < ActiveRecord::Base
120
- self.table_name_prefix = 'admin_'
121
- end
122
- end
123
- RUBY
118
+ <<-RUBY
119
+ module Admin
120
+ class User < ActiveRecord::Base
121
+ self.table_name_prefix = 'admin_'
122
+ end
123
+ end
124
+ RUBY
124
125
  end
125
126
  }
126
127
  require File.join(destination_root, "app/models/admin/user.rb")
@@ -159,96 +160,4 @@ RUBY
159
160
  it { should contain "create_table(:admin_users_admin_roles, :id => false) do" }
160
161
  end
161
162
  end
162
-
163
- describe 'specifying ORM adapter' do
164
- before(:all) { arguments [ "Role", "User", "--orm=mongoid" ] }
165
-
166
- before {
167
- capture(:stdout) {
168
- generator.create_file "app/models/user.rb" do
169
- <<-RUBY
170
- class User
171
- include Mongoid::Document
172
-
173
- field :login, :type => String
174
163
  end
175
- RUBY
176
- end
177
- }
178
- require File.join(destination_root, "app/models/user.rb")
179
- run_generator
180
- }
181
-
182
- describe 'config/initializers/rolify.rb' do
183
- subject { file('config/initializers/rolify.rb') }
184
- it { should exist }
185
- it { should contain "Rolify.configure do |config|"}
186
- it { should_not contain "# config.use_mongoid" }
187
- it { should contain "# config.use_dynamic_shortcuts" }
188
- end
189
-
190
- describe 'app/models/role.rb' do
191
- subject { file('app/models/role.rb') }
192
- it { should exist }
193
- it { should contain "class Role\n" }
194
- it { should contain "has_and_belongs_to_many :users\n" }
195
- it { should contain "belongs_to :resource, :polymorphic => true" }
196
- it { should contain "field :name, :type => String" }
197
- it { should contain " index({\n"
198
- " { :name => 1 },\n"
199
- " { :resource_type => 1 },\n"
200
- " { :resource_id => 1 }\n"
201
- " },\n"
202
- " { unique => true })"}
203
- end
204
-
205
- describe 'app/models/user.rb' do
206
- subject { file('app/models/user.rb') }
207
- it { should contain /class User\n include Mongoid::Document\n rolify\n/ }
208
- end
209
- end
210
-
211
- describe 'specifying namespaced User and Role class names and ORM adapter' do
212
- before(:all) { arguments %w(Admin::Role Admin::User --orm=mongoid) }
213
-
214
- before {
215
- capture(:stdout) {
216
- generator.create_file "app/models/admin/user.rb" do
217
- <<-RUBY
218
- module Admin
219
- class User
220
- include Mongoid::Document
221
- end
222
- end
223
- RUBY
224
- end
225
- }
226
- require File.join(destination_root, "app/models/admin/user.rb")
227
- run_generator
228
- }
229
-
230
- describe 'config/initializers/rolify.rb' do
231
- subject { file('config/initializers/rolify.rb') }
232
-
233
- it { should exist }
234
- it { should contain "Rolify.configure(\"Admin::Role\") do |config|"}
235
- it { should contain "# config.use_dynamic_shortcuts" }
236
- it { should_not contain "# config.use_mongoid" }
237
- end
238
-
239
- describe 'app/models/admin/role.rb' do
240
- subject { file('app/models/admin/role.rb') }
241
-
242
- it { should exist }
243
- it { should contain "class Admin::Role" }
244
- it { should contain "has_and_belongs_to_many :admin_users" }
245
- it { should contain "belongs_to :resource, :polymorphic => true" }
246
- end
247
-
248
- describe 'app/models/admin/user.rb' do
249
- subject { file('app/models/admin/user.rb') }
250
-
251
- it { should contain /class User\n include Mongoid::Document\n rolify :role_cname => 'Admin::Role'\n/ }
252
- end
253
- end
254
- end
@@ -0,0 +1,112 @@
1
+ require 'generators_helper'
2
+
3
+ require 'mongoid'
4
+
5
+ # Generators are not automatically loaded by Rails
6
+ require 'generators/rolify/rolify_generator'
7
+
8
+ describe Rolify::Generators::RolifyGenerator, :if => ENV['ADAPTER'] == 'mongoid' do
9
+ # Tell the generator where to put its output (what it thinks of as Rails.root)
10
+ destination File.expand_path("../../../../tmp", __FILE__)
11
+ teardown :cleanup_destination_root
12
+
13
+ before {
14
+ prepare_destination
15
+ }
16
+
17
+ def cleanup_destination_root
18
+ FileUtils.rm_rf destination_root
19
+ end
20
+
21
+ describe 'specifying ORM adapter' do
22
+ before(:all) { arguments [ "Role", "User", "--orm=mongoid" ] }
23
+
24
+ before {
25
+ capture(:stdout) {
26
+ generator.create_file "app/models/user.rb" do
27
+ <<-RUBY
28
+ class User
29
+ include Mongoid::Document
30
+
31
+ field :login, :type => String
32
+ end
33
+ RUBY
34
+ end
35
+ }
36
+ require File.join(destination_root, "app/models/user.rb")
37
+ run_generator
38
+ }
39
+
40
+ describe 'config/initializers/rolify.rb' do
41
+ subject { file('config/initializers/rolify.rb') }
42
+ it { should exist }
43
+ it { should contain "Rolify.configure do |config|"}
44
+ it { should_not contain "# config.use_mongoid" }
45
+ it { should contain "# config.use_dynamic_shortcuts" }
46
+ end
47
+
48
+ describe 'app/models/role.rb' do
49
+ subject { file('app/models/role.rb') }
50
+ it { should exist }
51
+ it { should contain "class Role\n" }
52
+ it { should contain "has_and_belongs_to_many :users\n" }
53
+ it { should contain "belongs_to :resource, :polymorphic => true" }
54
+ it { should contain "field :name, :type => String" }
55
+ it { should contain " index({\n"
56
+ " { :name => 1 },\n"
57
+ " { :resource_type => 1 },\n"
58
+ " { :resource_id => 1 }\n"
59
+ " },\n"
60
+ " { unique => true })"}
61
+ end
62
+
63
+ describe 'app/models/user.rb' do
64
+ subject { file('app/models/user.rb') }
65
+ it { should contain /class User\n include Mongoid::Document\n rolify\n/ }
66
+ end
67
+ end
68
+
69
+ describe 'specifying namespaced User and Role class names and ORM adapter' do
70
+ before(:all) { arguments %w(Admin::Role Admin::User --orm=mongoid) }
71
+
72
+ before {
73
+ capture(:stdout) {
74
+ generator.create_file "app/models/admin/user.rb" do
75
+ <<-RUBY
76
+ module Admin
77
+ class User
78
+ include Mongoid::Document
79
+ end
80
+ end
81
+ RUBY
82
+ end
83
+ }
84
+ require File.join(destination_root, "app/models/admin/user.rb")
85
+ run_generator
86
+ }
87
+
88
+ describe 'config/initializers/rolify.rb' do
89
+ subject { file('config/initializers/rolify.rb') }
90
+
91
+ it { should exist }
92
+ it { should contain "Rolify.configure(\"Admin::Role\") do |config|"}
93
+ it { should contain "# config.use_dynamic_shortcuts" }
94
+ it { should_not contain "# config.use_mongoid" }
95
+ end
96
+
97
+ describe 'app/models/admin/role.rb' do
98
+ subject { file('app/models/admin/role.rb') }
99
+
100
+ it { should exist }
101
+ it { should contain "class Admin::Role" }
102
+ it { should contain "has_and_belongs_to_many :admin_users" }
103
+ it { should contain "belongs_to :resource, :polymorphic => true" }
104
+ end
105
+
106
+ describe 'app/models/admin/user.rb' do
107
+ subject { file('app/models/admin/user.rb') }
108
+
109
+ it { should contain /class User\n include Mongoid::Document\n rolify :role_cname => 'Admin::Role'\n/ }
110
+ end
111
+ end
112
+ end
@@ -5,10 +5,17 @@ require 'rolify'
5
5
  require 'rolify/matchers'
6
6
  require 'rails/all'
7
7
 
8
+ require 'coveralls'
9
+ Coveralls.wear_merged!
10
+
8
11
  module TestApp
9
12
  class Application < ::Rails::Application
10
13
  config.root = File.dirname(__FILE__)
11
14
  end
12
15
  end
13
16
 
14
- require 'ammeter/init'
17
+ require 'ammeter/init'
18
+
19
+ ENV['ADAPTER'] ||= 'active_record'
20
+
21
+
@@ -13,6 +13,10 @@ describe "Rolify.namespace" do
13
13
  Admin::Right
14
14
  end
15
15
 
16
+ def join_table
17
+ "moderators_rights"
18
+ end
19
+
16
20
  it_behaves_like Rolify::Role
17
21
  it_behaves_like "Role.scopes"
18
22
  it_behaves_like Rolify::Dynamic
@@ -38,9 +38,16 @@ describe Rolify::Resource do
38
38
  it "should include Forum instances with forum role" do
39
39
  subject.with_role(:forum).should =~ [ Forum.first, Forum.last ]
40
40
  end
41
+
41
42
  it "should include Forum instances with godfather role" do
42
43
  subject.with_role(:godfather).should =~ Forum.all.to_a
43
44
  end
45
+
46
+ it "should be able to modify the resource", :if => ENV['ADAPTER'] == 'active_record' do
47
+ forum_resource = subject.with_role(:forum).first
48
+ forum_resource.name = "modified name"
49
+ expect(forum_resource.save).not_to raise_error
50
+ end
44
51
  end
45
52
 
46
53
  context "on the Group class" do
@@ -12,7 +12,9 @@ shared_examples_for "Rolify.callbacks" do
12
12
  describe "rolify association callbacks", :if => (Rolify.orm == "active_record") do
13
13
  describe "before_add" do
14
14
  it "should receive callback" do
15
- user_class.rolify :before_add => :role_callback, :role_cname => role_class.to_s
15
+ rolify_options = { :role_cname => role_class.to_s, :before_add => :role_callback }
16
+ rolify_options[:role_join_table_name] = join_table if defined? join_table
17
+ user_class.rolify rolify_options
16
18
  @user = user_class.first
17
19
  @user.stub(:role_callback)
18
20
  @user.should_receive(:role_callback)
@@ -22,7 +24,9 @@ shared_examples_for "Rolify.callbacks" do
22
24
 
23
25
  describe "after_add" do
24
26
  it "should receive callback" do
25
- user_class.rolify :after_add => :role_callback, :role_cname => role_class.to_s
27
+ rolify_options = { :role_cname => role_class.to_s, :after_add => :role_callback }
28
+ rolify_options[:role_join_table_name] = join_table if defined? join_table
29
+ user_class.rolify rolify_options
26
30
  @user = user_class.first
27
31
  @user.stub(:role_callback)
28
32
  @user.should_receive(:role_callback)
@@ -32,7 +36,9 @@ shared_examples_for "Rolify.callbacks" do
32
36
 
33
37
  describe "before_remove" do
34
38
  it "should receive callback" do
35
- user_class.rolify :before_remove => :role_callback, :role_cname => role_class.to_s
39
+ rolify_options = { :role_cname => role_class.to_s, :before_remove => :role_callback }
40
+ rolify_options[:role_join_table_name] = join_table if defined? join_table
41
+ user_class.rolify rolify_options
36
42
  @user = user_class.first
37
43
  @user.add_role :admin
38
44
  @user.stub(:role_callback)
@@ -44,7 +50,9 @@ shared_examples_for "Rolify.callbacks" do
44
50
 
45
51
  describe "after_remove" do
46
52
  it "should receive callback" do
47
- user_class.rolify :after_remove => :role_callback, :role_cname => role_class.to_s
53
+ rolify_options = { :role_cname => role_class.to_s, :after_remove => :role_callback }
54
+ rolify_options[:role_join_table_name] = join_table if defined? join_table
55
+ user_class.rolify rolify_options
48
56
  @user = user_class.first
49
57
  @user.add_role :admin
50
58
  @user.stub(:role_callback)
@@ -2,7 +2,9 @@ shared_examples_for Rolify::Dynamic do
2
2
  before(:all) do
3
3
  Rolify.dynamic_shortcuts = true
4
4
  role_class.destroy_all
5
- user_class.rolify :role_cname => role_class.to_s
5
+ rolify_options = { :role_cname => role_class.to_s }
6
+ rolify_options[:role_join_table_name] = join_table if defined? join_table
7
+ user_class.rolify rolify_options
6
8
  Forum.resourcify :roles, :role_cname => role_class.to_s
7
9
  Group.resourcify :roles, :role_cname => role_class.to_s
8
10
  end
@@ -12,6 +14,7 @@ shared_examples_for Rolify::Dynamic do
12
14
  admin = user_class.first
13
15
  admin.add_role :admin
14
16
  admin.add_role :moderator, Forum.first
17
+ admin.add_role :solo
15
18
  admin
16
19
  end
17
20
 
@@ -22,12 +25,22 @@ shared_examples_for Rolify::Dynamic do
22
25
  it { subject.is_admin?.should be(true) }
23
26
  it { subject.is_admin?.should be(true) }
24
27
  it { subject.is_admin?.should be(true) }
28
+
29
+ context "removing the role on the last user having it" do
30
+ before do
31
+ subject.remove_role :solo
32
+ end
33
+
34
+ it { should_not respond_to(:is_solo?) }
35
+ it { subject.is_solo?.should be(false) }
36
+ end
25
37
  end
26
38
 
27
39
  context "using a resource scoped role" do
28
40
  subject do
29
41
  moderator = user_class.where(:login => "moderator").first
30
42
  moderator.add_role :moderator, Forum.first
43
+ moderator.add_role :sole_mio, Forum.last
31
44
  moderator
32
45
  end
33
46
 
@@ -44,12 +57,22 @@ shared_examples_for Rolify::Dynamic do
44
57
  it { subject.is_moderator_of?(Group).should be(false) }
45
58
  it { subject.is_moderator_of?(Group.first).should be(false) }
46
59
  it { subject.is_moderator_of?(Group.last).should be(false) }
60
+
61
+ context "removing the role on the last user having it" do
62
+ before do
63
+ subject.remove_role :sole_mio, Forum.last
64
+ end
65
+
66
+ it { should_not respond_to(:is_sole_mio?) }
67
+ it { subject.is_sole_mio?.should be(false) }
68
+ end
47
69
  end
48
70
 
49
71
  context "using a class scoped role" do
50
72
  subject do
51
73
  manager = user_class.where(:login => "god").first
52
74
  manager.add_role :manager, Forum
75
+ manager.add_role :only_me, Forum
53
76
  manager
54
77
  end
55
78
 
@@ -68,6 +91,15 @@ shared_examples_for Rolify::Dynamic do
68
91
  it { subject.is_manager_of?(Group).should be(false) }
69
92
  it { subject.is_manager_of?(Group.first).should be(false) }
70
93
  it { subject.is_manager_of?(Group.last).should be(false) }
94
+
95
+ context "removing the role on the last user having it" do
96
+ before do
97
+ subject.remove_role :only_me, Forum
98
+ end
99
+
100
+ it { should_not respond_to(:is_only_me?) }
101
+ it { subject.is_only_me?.should be(false) }
102
+ end
71
103
  end
72
104
 
73
105
  context "if the role doesn't exist in the database" do
@@ -85,6 +117,7 @@ shared_examples_for Rolify::Dynamic do
85
117
  it { should_not respond_to(:is_god?) }
86
118
 
87
119
  it { subject.is_superman?.should be(false) }
120
+ it { subject.is_god?.should be(false) }
88
121
  end
89
122
 
90
123
  context "using a resource scope role" do
@@ -105,6 +138,14 @@ shared_examples_for Rolify::Dynamic do
105
138
  it { subject.is_batman_of?(Group).should be(false) }
106
139
  it { subject.is_batman_of?(Group.first).should be(false) }
107
140
  it { subject.is_batman_of?(Group.last).should be(false) }
141
+
142
+ it { subject.is_god?.should be(false) }
143
+ it { subject.is_god_of?(Forum).should be(false) }
144
+ it { subject.is_god_of?(Forum.first).should be(false) }
145
+ it { subject.is_god_of?(Forum.last).should be(false) }
146
+ it { subject.is_god_of?(Group).should be(false) }
147
+ it { subject.is_god_of?(Group.first).should be(false) }
148
+ it { subject.is_god_of?(Group.last).should be(false) }
108
149
  end
109
150
  end
110
151
  end
@@ -11,13 +11,15 @@ shared_examples_for Rolify::Role do
11
11
  before(:all) do
12
12
  reset_defaults
13
13
  Rolify.dynamic_shortcuts = false
14
- user_class.rolify :role_cname => role_class.to_s
14
+ rolify_options = { :role_cname => role_class.to_s }
15
+ rolify_options[:role_join_table_name] = join_table if defined? join_table
16
+ user_class.rolify rolify_options
15
17
  role_class.destroy_all
16
18
  Forum.resourcify :roles, :role_cname => role_class.to_s
17
19
  Group.resourcify :roles, :role_cname => role_class.to_s
18
20
  end
19
21
 
20
- context "in the Instance level " do
22
+ context "in the Instance level" do
21
23
  before(:all) do
22
24
  admin = user_class.first
23
25
  admin.add_role :admin
@@ -28,7 +28,7 @@ shared_examples_for "Role.scopes" do
28
28
  let!(:zombie_role) { subject.add_role :visitor, Forum.last }
29
29
  let!(:anonymous_role) { subject.add_role :anonymous, Group.last }
30
30
 
31
- it { subject.roles.instance_scoped.all.entries.should =~ [ visitor_role, zombie_role, anonymous_role ] }
31
+ it { subject.roles.instance_scoped.to_a.entries.should =~ [ visitor_role, zombie_role, anonymous_role ] }
32
32
  it { subject.roles.instance_scoped(Forum).should =~ [ visitor_role, zombie_role ] }
33
33
  it { subject.roles.instance_scoped(Forum.first).should =~ [ visitor_role ] }
34
34
  it { subject.roles.instance_scoped(Forum.last).should =~ [ zombie_role ] }
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,9 @@ require 'rolify'
5
5
  require 'rolify/matchers'
6
6
  require 'rails/all'
7
7
 
8
+ require 'coveralls'
9
+ Coveralls.wear_merged!
10
+
8
11
  ENV['ADAPTER'] ||= 'active_record'
9
12
 
10
13
  load File.dirname(__FILE__) + "/support/adapters/#{ENV['ADAPTER']}.rb"
@@ -43,11 +43,11 @@ module Admin
43
43
  end
44
44
 
45
45
  class Moderator < ActiveRecord::Base
46
- rolify :role_cname => "Admin::Right"
46
+ rolify :role_cname => "Admin::Right", :role_join_table_name => "moderators_rights"
47
47
  end
48
48
 
49
49
  class Right < ActiveRecord::Base
50
- has_and_belongs_to_many :moderators, :class_name => "Admin::Moderator",:join_table => :admin_moderators_admin_rights
50
+ has_and_belongs_to_many :moderators, :class_name => "Admin::Moderator", :join_table => "moderators_rights"
51
51
  belongs_to :resource, :polymorphic => true
52
52
 
53
53
  extend Rolify::Adapter::Scopes
@@ -72,5 +72,5 @@ class Team < ActiveRecord::Base
72
72
  #resourcify done during specs setup to be able to use custom user classes
73
73
  self.primary_key = "team_code"
74
74
 
75
- default_scope order(:team_code)
75
+ default_scope { order(:team_code) }
76
76
  end
@@ -31,7 +31,7 @@ ActiveRecord::Schema.define do
31
31
  t.references :privilege
32
32
  end
33
33
 
34
- create_table(:admin_moderators_admin_rights, :id => false) do |t|
34
+ create_table(:moderators_rights, :id => false) do |t|
35
35
  t.references :moderator
36
36
  t.references :right
37
37
  end
metadata CHANGED
@@ -1,142 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rolify
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0.rc4
5
- prerelease: 6
4
+ version: 3.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Florent Monbillard
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-12 00:00:00.000000000 Z
11
+ date: 2014-01-26 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: ammeter
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '2.0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '2.0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec-rails
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '2.0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '2.0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: bundler
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: fuubar
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: activerecord
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: 3.2.0
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - ">="
124
109
  - !ruby/object:Gem::Version
125
110
  version: 3.2.0
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: mongoid
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - ">="
132
116
  - !ruby/object:Gem::Version
133
117
  version: '3.1'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - ">="
140
123
  - !ruby/object:Gem::Version
141
124
  version: '3.1'
142
125
  description: Very simple Roles library without any authorization enforcement supporting
@@ -148,8 +131,8 @@ executables: []
148
131
  extensions: []
149
132
  extra_rdoc_files: []
150
133
  files:
151
- - .gitignore
152
- - .travis.yml
134
+ - ".gitignore"
135
+ - ".travis.yml"
153
136
  - CHANGELOG.rdoc
154
137
  - Gemfile
155
138
  - LICENSE
@@ -188,7 +171,8 @@ files:
188
171
  - lib/rolify/version.rb
189
172
  - rolify.gemspec
190
173
  - spec/README.rdoc
191
- - spec/generators/rolify/rolify_generator_spec.rb
174
+ - spec/generators/rolify/rolify_activerecord_generator_spec.rb
175
+ - spec/generators/rolify/rolify_mongoid_generator_spec.rb
192
176
  - spec/generators_helper.rb
193
177
  - spec/rolify/config_spec.rb
194
178
  - spec/rolify/custom_spec.rb
@@ -217,31 +201,31 @@ files:
217
201
  - spec/support/schema.rb
218
202
  homepage: http://eppo.github.com/rolify/
219
203
  licenses: []
204
+ metadata: {}
220
205
  post_install_message:
221
206
  rdoc_options: []
222
207
  require_paths:
223
208
  - lib
224
209
  required_ruby_version: !ruby/object:Gem::Requirement
225
- none: false
226
210
  requirements:
227
- - - ! '>='
211
+ - - ">="
228
212
  - !ruby/object:Gem::Version
229
213
  version: '0'
230
214
  required_rubygems_version: !ruby/object:Gem::Requirement
231
- none: false
232
215
  requirements:
233
- - - ! '>'
216
+ - - ">="
234
217
  - !ruby/object:Gem::Version
235
- version: 1.3.1
218
+ version: '0'
236
219
  requirements: []
237
220
  rubyforge_project: rolify
238
- rubygems_version: 1.8.25
221
+ rubygems_version: 2.0.3
239
222
  signing_key:
240
- specification_version: 3
223
+ specification_version: 4
241
224
  summary: Roles library with resource scoping
242
225
  test_files:
243
226
  - spec/README.rdoc
244
- - spec/generators/rolify/rolify_generator_spec.rb
227
+ - spec/generators/rolify/rolify_activerecord_generator_spec.rb
228
+ - spec/generators/rolify/rolify_mongoid_generator_spec.rb
245
229
  - spec/generators_helper.rb
246
230
  - spec/rolify/config_spec.rb
247
231
  - spec/rolify/custom_spec.rb
@@ -268,3 +252,4 @@ test_files:
268
252
  - spec/support/adapters/mongoid.yml
269
253
  - spec/support/data.rb
270
254
  - spec/support/schema.rb
255
+ has_rdoc: