roles_generic 0.2.4 → 0.2.5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -29,6 +29,14 @@ class Role
29
29
 
30
30
  class << self
31
31
  attr_accessor :roles
32
+
33
+ def all
34
+ roles.to_a
35
+ end
36
+
37
+ def names
38
+ roles.map(&:name)
39
+ end
32
40
  end
33
41
 
34
42
  def initialize name
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{roles_generic}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
12
- s.date = %q{2010-09-12}
12
+ s.date = %q{2010-09-13}
13
13
  s.description = %q{Generic role strategies sharing the same API. Easy to insert in any model}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -26,6 +26,11 @@ describe "Generic ManyRoles role strategy" do
26
26
  @user = User.new 'User', :user
27
27
  end
28
28
 
29
+ it "should return all registered roles" do
30
+ Role.all.should include(Role.roles.to_a[0])
31
+ Role.names.should include( :admin, :user )
32
+ end
33
+
29
34
  it "should have admin user role to :admin" do
30
35
  @admin_user.roles_list.first.should == :admin
31
36
  @admin_user.admin?.should be_true
@@ -26,6 +26,11 @@ describe "Generic OneRole role strategy" do
26
26
  @user = User.new 'User', :user
27
27
  end
28
28
 
29
+ it "should return all registered roles" do
30
+ Role.all.should include(Role.roles.to_a[0])
31
+ Role.names.should include( :admin, :user )
32
+ end
33
+
29
34
  it "should have admin user role to :admin" do
30
35
  @admin_user.role.should == :admin
31
36
  @admin_user.roles.should == [:admin]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 4
9
- version: 0.2.4
8
+ - 5
9
+ version: 0.2.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kristian Mandrup
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-12 00:00:00 +02:00
17
+ date: 2010-09-13 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency