dar_da_da 0.0.5 → 0.0.6

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: f3508fbde233fce90f037ff62c15721426891bef
4
- data.tar.gz: a6b5e04b1a88b2ad6d1752c0f21da50b327e6a42
3
+ metadata.gz: 2cbcc4b69917c7ca27338f031a305db6cf41c8e1
4
+ data.tar.gz: e679ab5829006b42be6100769d2d8603b1bb2ef3
5
5
  SHA512:
6
- metadata.gz: 4aec035d497a9378ec819d01305ec3cbf0f03dea9db724500d5659c18993325ae6c11ef65158235660f13ff263e9ee89f3964d7e5ecbf14f955c93a26deeceff
7
- data.tar.gz: 595661f990878b8847aa363c16955e1f50cdc25b01737555151e4fef142975528ad3481eb34fb39dfe0132f994c5851c7b51e65099b6ae075ed91634bd5d553c
6
+ metadata.gz: d9661616f99dcef354a0c4893558e173cccc962459c4823cbbf6578e14ca18f681062547cb3982b1ae7b0056d70e9f02321d3242c83e3675755d4966ad3d7068
7
+ data.tar.gz: 071d5455d3190a7ae7c736bf625620a7aca49e59141e92e26f25f7d9a2a5a7a40799bebe10a38aadd74747ef2292a236ffd5f5121dd446d0a6b8c1da5ce63b95
data/CHANGES.md CHANGED
@@ -1,15 +1,22 @@
1
1
  ### dev
2
2
 
3
- [full changelog](http://github.com/yolk/valvat/compare/v0.0.5...master)
3
+ [full changelog](http://github.com/yolk/dar_dar_da/compare/v0.0.6...master)
4
+
5
+ ### 0.0.5 / 2017-01-31
6
+
7
+ [full changelog](http://github.com/yolk/dar_dar_da/compare/v0.0.6...v0.0.5)
8
+
9
+ * Use before_action instead of before_filter
10
+ * Require Rails >= 4.0
4
11
 
5
12
  ### 0.0.5 / 2014-04-09
6
13
 
7
- [full changelog](http://github.com/yolk/valvat/compare/v0.0.5...v0.0.3)
14
+ [full changelog](http://github.com/yolk/dar_dar_da/compare/v0.0.5...v0.0.3)
8
15
 
9
16
  * Compatiblity with Rails 4.0
10
17
 
11
18
  ### 0.0.3 / 2012-02-06
12
19
 
13
- [full changelog](http://github.com/yolk/valvat/compare/v0.0.2...v0.0.3)
20
+ [full changelog](http://github.com/yolk/dar_dar_da/compare/v0.0.2...v0.0.3)
14
21
 
15
- * Compatiblity with Rails 3.2
22
+ * Compatiblity with Rails 3.2
data/Guardfile CHANGED
@@ -1,5 +1,5 @@
1
- guard 'rspec', :version => 2 do
1
+ guard 'rspec', cmd: "bundle exec rspec --color" do
2
2
  watch(/^spec\/(.*)_spec\.rb/) { "spec" }
3
3
  watch(/^lib\/(.*)\.rb/) { "spec" } # { |m| "spec/#{m[1]}_spec.rb" }
4
4
  watch(/^spec\/spec_helper\.rb/) { "spec" }
5
- end
5
+ end
data/README.rdoc CHANGED
@@ -4,4 +4,4 @@ Roles easy like sunday morning.
4
4
 
5
5
  == Copyright
6
6
 
7
- Copyright (c) 2009 Yolk GbR. See LICENSE for details.
7
+ Copyright (c) 2009-2017 Yolk GbR. See LICENSE for details.
data/dar_da_da.gemspec CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'activerecord', '>= 3.0'
22
+ s.add_dependency 'activerecord', '>= 4.0'
23
23
 
24
24
  # Actionpack is optional!
25
- s.add_development_dependency 'actionpack', '>= 3.0'
25
+ s.add_development_dependency 'actionpack', '>= 4.0'
26
26
  s.add_development_dependency 'rspec'
27
27
  s.add_development_dependency 'guard-rspec'
28
- s.add_development_dependency 'sqlite3-ruby'
28
+ s.add_development_dependency 'sqlite3'
29
29
  end
@@ -6,25 +6,25 @@ module DarDaDa
6
6
  base.class_eval "class ::ActionController::ForbiddenError < ::ActionController::ActionControllerError;end"
7
7
  end
8
8
  end
9
-
10
- module ClassMethods
9
+
10
+ module ClassMethods
11
11
  def define_access_control(user_class, user_method_name = :current_user)
12
12
  user_class.dar_dar_da.all_rights.each do |right|
13
13
  self.class_eval("
14
14
  private
15
-
15
+
16
16
  def check_if_#{user_class.name.downcase}_is_allowed_to_#{right}
17
17
  raise ActionController::ForbiddenError.new unless #{user_method_name}.allowed_to_#{right}?
18
18
  end
19
19
  ")
20
-
20
+
21
21
  self.class_eval("
22
22
  def self.require_right(right, options={})
23
- before_filter :\"check_if_#{user_class.name.downcase}_is_allowed_to_#\{right}\", options
23
+ before_action :\"check_if_#{user_class.name.downcase}_is_allowed_to_#\{right}\", options
24
24
  end
25
25
  ")
26
26
  end
27
27
  end
28
28
  end
29
29
  end
30
- end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module DarDaDa
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -2,16 +2,16 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe DarDaDa::ActionControllerExtension, "extended Base" do
4
4
  it "should define only_if_{user}_is_allowed_to_{right} methods" do
5
- ApplicationController.private_instance_methods.map(&:to_s).should include("check_if_user_is_allowed_to_cancel_account")
5
+ expect(ApplicationController.private_instance_methods.map(&:to_s)).to include("check_if_user_is_allowed_to_cancel_account")
6
6
  User.create!(:role => :user)
7
- lambda{
8
- ApplicationController.new.send(:check_if_user_is_allowed_to_cancel_account)
9
- }.should raise_error(ActionController::ForbiddenError)
7
+ expect {
8
+ ApplicationController.new.send(:check_if_user_is_allowed_to_cancel_account)
9
+ }.to raise_error(ActionController::ForbiddenError)
10
10
  end
11
-
11
+
12
12
  it "should define only_if_user_is_allowed_to class method" do
13
- ApplicationController.methods.map(&:to_s).should include("require_right")
14
- ApplicationController.should_receive(:before_filter).with(:check_if_user_is_allowed_to_read_acticles, :only => [:index])
13
+ expect(ApplicationController.methods.map(&:to_s)).to include("require_right")
14
+ expect(ApplicationController).to receive(:before_action).with(:check_if_user_is_allowed_to_read_acticles, :only => [:index])
15
15
  ApplicationController.require_right(:read_acticles, :only => [:index])
16
16
  end
17
- end
17
+ end
@@ -4,75 +4,75 @@ describe DarDaDa::ActiveRecordExtension, "extended Model" do
4
4
  before { @user = User.create! }
5
5
 
6
6
  it "should set role to default_role" do
7
- @user.role.should eql("user")
8
- User.new.role.should eql("user")
7
+ expect(@user.role).to eql("user")
8
+ expect(User.new.role).to eql("user")
9
9
  end
10
10
 
11
11
  it "should add role accessor to map role_attribute" do
12
12
  @user.role = :author
13
- @user.role.should eql("author")
13
+ expect(@user.role).to eql("author")
14
14
  @user.role = :unknown_role
15
- @user.role.should eql("author")
15
+ expect(@user.role).to eql("author")
16
16
  @user.save!
17
- @user.role.should eql("author")
17
+ expect(@user.role).to eql("author")
18
18
  @user.update_attributes!(:role => 'user')
19
- @user.role.should eql("user")
19
+ expect(@user.role).to eql("user")
20
20
  end
21
21
 
22
22
  it "should set default_role to user" do
23
- User.dar_dar_da.options[:default_role].should == (:"user")
23
+ expect(User.dar_dar_da.options[:default_role]).to eql :user
24
24
  end
25
25
 
26
26
  it "should prevent saving role_attribute with nil or empty" do
27
27
  @user.role_name = ""
28
- @user.send(:read_role_attribute).should be_blank
28
+ expect(@user.send(:read_role_attribute)).to be_blank
29
29
  @user.save!
30
30
  @user.reload
31
- @user.send(:read_role_attribute).should eql("user")
32
- @user.role_name.should eql("user")
33
- @user.role.should eql("user")
31
+ expect(@user.send(:read_role_attribute)).to eql("user")
32
+ expect(@user.role_name).to eql("user")
33
+ expect(@user.role).to eql("user")
34
34
  end
35
35
 
36
36
  it "should prevent saving role_attribute with not exisiting role" do
37
37
  @user.role_name = "unknown"
38
- @user.send(:read_role_attribute).should eql("unknown")
38
+ expect(@user.send(:read_role_attribute)).to eql("unknown")
39
39
  @user.save!
40
40
  @user.reload
41
- @user.send(:read_role_attribute).should eql("user")
42
- @user.role_name.should eql("user")
43
- @user.role.should eql("user")
41
+ expect(@user.send(:read_role_attribute)).to eql("user")
42
+ expect(@user.role_name).to eql("user")
43
+ expect(@user.role).to eql("user")
44
44
  end
45
45
 
46
46
  it "should add {role}? methods" do
47
- @user.should be_user
47
+ expect(@user).to be_user
48
48
  @user.role = :author
49
- @user.should be_author
49
+ expect(@user).to be_author
50
50
  @user.role = :admin
51
- @user.should be_admin
51
+ expect(@user).to be_admin
52
52
  end
53
53
 
54
54
  it "should add allowed_to? method" do
55
- @user.allowed_to?(:read_acticles).should be_true
56
- @user.allowed_to?("read_acticles").should be_true
57
- @user.allowed_to?(:write_acticles).should be_false
58
- @user.allowed_to?(:cancel_account).should be_false
59
- @user.allowed_to?(:do_unknown_stuff).should be_false
60
- @user.allowed_to?("").should be_false
61
- @user.allowed_to?(nil).should be_false
55
+ expect(@user.allowed_to?(:read_acticles)).to be true
56
+ expect(@user.allowed_to?("read_acticles")).to be true
57
+ expect(@user.allowed_to?(:write_acticles)).to be false
58
+ expect(@user.allowed_to?(:cancel_account)).to be false
59
+ expect(@user.allowed_to?(:do_unknown_stuff)).to be false
60
+ expect(@user.allowed_to?("")).to be false
61
+ expect(@user.allowed_to?(nil)).to be false
62
62
  end
63
63
 
64
64
  it "should add allowed_to_{right}? methods" do
65
- @user.should be_allowed_to_read_acticles
66
- @user.should_not be_allowed_to_write_acticles
67
- @user.should_not be_allowed_to_cancel_account
65
+ expect(@user).to be_allowed_to_read_acticles
66
+ expect(@user).to_not be_allowed_to_write_acticles
67
+ expect(@user).to_not be_allowed_to_cancel_account
68
68
  @user.role = :author
69
- @user.should be_allowed_to_read_acticles
70
- @user.should be_allowed_to_write_acticles
71
- @user.should_not be_allowed_to_cancel_account
69
+ expect(@user).to be_allowed_to_read_acticles
70
+ expect(@user).to be_allowed_to_write_acticles
71
+ expect(@user).to_not be_allowed_to_cancel_account
72
72
  @user.role = :admin
73
- @user.should be_allowed_to_read_acticles
74
- @user.should be_allowed_to_write_acticles
75
- @user.should be_allowed_to_cancel_account
73
+ expect(@user).to be_allowed_to_read_acticles
74
+ expect(@user).to be_allowed_to_write_acticles
75
+ expect(@user).to be_allowed_to_cancel_account
76
76
  end
77
77
 
78
78
  it "should add named_scope for every role" do
@@ -80,8 +80,8 @@ describe DarDaDa::ActiveRecordExtension, "extended Model" do
80
80
  User.create!(:role => "admin")
81
81
  2.times { User.create!(:role => :author) }
82
82
  3.times { User.create!(:role => :user) }
83
- User.admins.map(&:role).should eql(["admin"])
84
- User.authors.map(&:role).should eql(["author", "author"])
85
- User.users.map(&:role).should eql(["user", "user", "user"])
83
+ expect(User.admins.map(&:role)).to eql(["admin"])
84
+ expect(User.authors.map(&:role)).to eql(["author", "author"])
85
+ expect(User.users.map(&:role)).to eql(["user", "user", "user"])
86
86
  end
87
- end
87
+ end
@@ -1,139 +1,139 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe DarDaDa::Config do
4
-
4
+
5
5
  it "should require nothing as attribute" do
6
- lambda { DarDaDa::Config.new }.should_not raise_error
6
+ expect { DarDaDa::Config.new }.not_to raise_error
7
7
  end
8
-
8
+
9
9
  it "should be empty " do
10
- DarDaDa::Config.new.should be_empty
10
+ expect(DarDaDa::Config.new).to be_empty
11
11
  end
12
-
12
+
13
13
  it "should allow accessing role by string" do
14
14
  config = DarDaDa::Config.new do
15
15
  role :admin
16
16
  end
17
- config["admin"].should eql(config[:admin])
17
+ expect(config["admin"]).to eql(config[:admin])
18
18
  config[nil]
19
19
  config[""]
20
20
  end
21
-
21
+
22
22
  describe "options" do
23
23
  it "should have role_attribute set to role_name default" do
24
- DarDaDa::Config.new.options[:role_attribute].should eql(:role_name)
24
+ expect(DarDaDa::Config.new.options[:role_attribute]).to eql(:role_name)
25
25
  end
26
-
26
+
27
27
  it "should allow setting role_attribute via options" do
28
- DarDaDa::Config.new(:role_attribute => :role).options[:role_attribute].should eql(:role)
28
+ expect(DarDaDa::Config.new(:role_attribute => :role).options[:role_attribute]).to eql(:role)
29
29
  end
30
30
  end
31
-
31
+
32
32
  it "should eval block inside instance" do
33
- lambda { DarDaDa::Config.new do
33
+ expect { DarDaDa::Config.new do
34
34
  raise "config_error"
35
- end }.should raise_error("config_error")
35
+ end }.to raise_error("config_error")
36
36
  end
37
-
37
+
38
38
  describe "role" do
39
-
39
+
40
40
  it "should add new instance to roles" do
41
41
  config = DarDaDa::Config.new do
42
42
  role :admin
43
43
  end
44
- config.keys.should eql([:admin])
44
+ expect(config.keys).to eql([:admin])
45
45
  end
46
-
46
+
47
47
  it "should eval role-block inside role-instance" do
48
- lambda { DarDaDa::Config.new do
48
+ expect { DarDaDa::Config.new do
49
49
  role :admin do
50
50
  raise name.to_s + "_deep_error"
51
51
  end
52
- end }.should raise_error("admin_deep_error")
53
-
52
+ end }.to raise_error("admin_deep_error")
53
+
54
54
  config = DarDaDa::Config.new do
55
55
  role :admin do
56
56
  is_allowed_to :manage_users
57
57
  end
58
58
  end
59
-
60
- config.should == ({:admin => [:manage_users]})
59
+
60
+ expect(config).to eql ({:admin => [:manage_users]})
61
61
  end
62
-
62
+
63
63
  it "should eval role-block inside of exisiting role-instance" do
64
64
  config = DarDaDa::Config.new do
65
65
  role :admin do
66
66
  is_allowed_to :manage_users
67
67
  end
68
-
68
+
69
69
  role :admin do
70
70
  is_allowed_to :manage_projects
71
71
  end
72
72
  end
73
-
74
- config.should == ({:admin => [:manage_users, :manage_projects]})
73
+
74
+ expect(config).to eql ({:admin => [:manage_users, :manage_projects]})
75
75
  end
76
-
76
+
77
77
  it "should reopen existing config and eval block" do
78
78
  config = DarDaDa::Config.new
79
79
  config.reopen do
80
80
  role :admin
81
81
  end
82
- config.keys.should eql([:admin])
82
+ expect(config.keys).to eql([:admin])
83
83
  end
84
-
84
+
85
85
  end
86
-
86
+
87
87
  describe "default_role" do
88
88
  it "should have empty default_role" do
89
- DarDaDa::Config.new.options[:default_role].should be_nil
89
+ expect(DarDaDa::Config.new.options[:default_role]).to be_nil
90
90
  end
91
-
91
+
92
92
  it "should set first added role to default_role by default" do
93
93
  config = DarDaDa::Config.new do
94
94
  role :admin
95
95
  role :author
96
96
  end
97
- config.options[:default_role].should eql(:admin)
97
+ expect(config.options[:default_role]).to eql(:admin)
98
98
  end
99
-
99
+
100
100
  it "should allow setting default_role while initalizing" do
101
101
  config = DarDaDa::Config.new :default_role => :admin do
102
102
  role :author
103
103
  role :admin
104
104
  end
105
- config.options[:default_role].should eql(:admin)
105
+ expect(config.options[:default_role]).to eql(:admin)
106
106
  end
107
-
107
+
108
108
  it "should remove nonexisiting roles after initalizing" do
109
109
  config = DarDaDa::Config.new :default_role => :admin do
110
110
  end
111
- config.options[:default_role].should be_nil
111
+ expect(config.options[:default_role]).to be_nil
112
112
  config = DarDaDa::Config.new :default_role => :admin
113
- config.options[:default_role].should be_nil
113
+ expect(config.options[:default_role]).to be_nil
114
114
  end
115
-
115
+
116
116
  it "should take first added role even when invalid other specified" do
117
117
  config = DarDaDa::Config.new :default_role => :admin do
118
118
  role :author
119
119
  end
120
- config.options[:default_role].should eql(:author)
120
+ expect(config.options[:default_role]).to eql(:author)
121
121
  end
122
-
122
+
123
123
  it "should allow setting role to default_role when given" do
124
124
  config = DarDaDa::Config.new do
125
125
  role :admin
126
126
  role :author, :default => true
127
127
  end
128
- config.options[:default_role].should eql(:author)
128
+ expect(config.options[:default_role]).to eql(:author)
129
129
  end
130
130
  end
131
-
131
+
132
132
  describe "all_rights" do
133
133
  it "should be empty by default" do
134
- DarDaDa::Config.new.all_rights.should eql([])
134
+ expect(DarDaDa::Config.new.all_rights).to eql([])
135
135
  end
136
-
136
+
137
137
  it "should collect all rights" do
138
138
  config = DarDaDa::Config.new do
139
139
  role :admin do
@@ -144,10 +144,10 @@ describe DarDaDa::Config do
144
144
  is_allowed_to :d
145
145
  end
146
146
  end
147
- config.all_rights.should include(:a, :b, :c, :d, :e)
148
- config.all_rights.size.should eql([:a, :b, :c, :d, :e].size)
147
+ expect(config.all_rights).to include(:a, :b, :c, :d, :e)
148
+ expect(config.all_rights.size).to eql([:a, :b, :c, :d, :e].size)
149
149
  end
150
-
150
+
151
151
  it "should remove duplicates" do
152
152
  config = DarDaDa::Config.new do
153
153
  role :admin do
@@ -159,54 +159,54 @@ describe DarDaDa::Config do
159
159
  is_allowed_to :c
160
160
  end
161
161
  end
162
-
163
- config.all_rights.should include(:a, :b, :c)
164
- config.all_rights.size.should eql([:a, :b, :c].size)
162
+
163
+ expect(config.all_rights).to include(:a, :b, :c)
164
+ expect(config.all_rights.size).to eql([:a, :b, :c].size)
165
165
  end
166
166
  end
167
-
167
+
168
168
  describe "based_on" do
169
169
  it "should copy rights between roles" do
170
170
  config = DarDaDa::Config.new do
171
-
171
+
172
172
  role :author do
173
173
  based_on :user
174
174
  is_allowed_to :write_articles
175
175
  end
176
-
176
+
177
177
  role :user do
178
178
  is_allowed_to :read_articles
179
179
  end
180
-
180
+
181
181
  role :admin do
182
182
  based_on :author
183
183
  is_allowed_to :cancel_accounts
184
184
  end
185
185
  end
186
-
187
- config[:admin].should == ([:cancel_accounts, :write_articles, :read_articles])
188
- config[:author].should == ([:write_articles, :read_articles])
189
- config[:user].should == ([:read_articles])
186
+
187
+ expect(config[:admin]).to eql ([:cancel_accounts, :write_articles, :read_articles])
188
+ expect(config[:author]).to eql ([:write_articles, :read_articles])
189
+ expect(config[:user]).to eql ([:read_articles])
190
190
  end
191
-
191
+
192
192
  it "should throw error on circular references" do
193
- lambda { config = DarDaDa::Config.new do
194
-
193
+ expect { config = DarDaDa::Config.new do
194
+
195
195
  role :author do
196
196
  based_on :user
197
197
  is_allowed_to :write_articles
198
198
  end
199
-
199
+
200
200
  role :user do
201
201
  based_on :admin
202
202
  is_allowed_to :read_articles
203
203
  end
204
-
204
+
205
205
  role :admin do
206
206
  based_on :author
207
207
  is_allowed_to :cancel_accounts
208
208
  end
209
- end }.should raise_error("You defined a circular reference when configuring DarDaDa with 'based_on'.")
209
+ end }.to raise_error("You defined a circular reference when configuring DarDaDa with 'based_on'.")
210
210
  end
211
211
  end
212
- end
212
+ end
@@ -1,69 +1,69 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe DarDaDa::Role do
4
-
4
+
5
5
  before do
6
6
  @role = DarDaDa::Role.new(:role1)
7
7
  end
8
-
8
+
9
9
  it "should require name as attribute" do
10
- lambda { DarDaDa::Role.new }.should raise_error(ArgumentError)
11
- DarDaDa::Role.new(:role1).name.should eql(:role1)
10
+ expect { DarDaDa::Role.new }.to raise_error(ArgumentError)
11
+ expect(DarDaDa::Role.new(:role1).name).to eql(:role1)
12
12
  end
13
-
13
+
14
14
  it "should store name as symbol" do
15
- DarDaDa::Role.new("role1").name.should eql(:role1)
15
+ expect(DarDaDa::Role.new("role1").name).to eql(:role1)
16
16
  end
17
-
17
+
18
18
  it "should be empty array" do
19
- @role.should eql([])
19
+ expect(@role).to eql([])
20
20
  end
21
-
21
+
22
22
  it "should convert strings to symbols when adding" do
23
23
  @role << :r1
24
- @role.should eql([:r1])
24
+ expect(@role).to eql([:r1])
25
25
  @role << "r2"
26
- @role.should eql([:r1, :r2])
26
+ expect(@role).to eql([:r1, :r2])
27
27
  end
28
-
28
+
29
29
  it "should have include?/memeber? methods that convert strings to symbols" do
30
30
  @role << :manage_projects
31
- @role.include?(:manage_projects).should be_true
32
- @role.include?("manage_projects").should be_true
33
- @role.include?("manage_users").should be_false
34
- @role.member?(:manage_projects).should be_true
35
- @role.member?("manage_projects").should be_true
36
- @role.member?("manage_users").should be_false
31
+ expect(@role.include?(:manage_projects)).to be true
32
+ expect(@role.include?("manage_projects")).to be true
33
+ expect(@role.include?("manage_users")).to be false
34
+ expect(@role.member?(:manage_projects)).to be true
35
+ expect(@role.member?("manage_projects")).to be true
36
+ expect(@role.member?("manage_users")).to be false
37
37
  end
38
-
38
+
39
39
  describe "is_allowed_to" do
40
40
  it "should add new instance to rights" do
41
41
  @role.is_allowed_to :manage_projects
42
- @role.should eql([:manage_projects])
42
+ expect(@role).to eql([:manage_projects])
43
43
  end
44
-
44
+
45
45
  it "should convert strings to symbols" do
46
46
  @role.is_allowed_to "manage_projects"
47
- @role.should eql([:manage_projects])
47
+ expect(@role).to eql([:manage_projects])
48
48
  end
49
-
49
+
50
50
  it "should allow adding multiple rights at once" do
51
51
  @role.is_allowed_to :manage_projects, :cancel_account
52
- @role.should eql([:manage_projects, :cancel_account])
52
+ expect(@role).to eql([:manage_projects, :cancel_account])
53
53
  end
54
54
  end
55
-
55
+
56
56
  describe "based_on" do
57
57
  it "should add new instance to merge_rights_from" do
58
58
  role = DarDaDa::Role.new(:admin)
59
59
  role.based_on "author"
60
- role.merge_rights_from.should eql([:author])
60
+ expect(role.merge_rights_from).to eql([:author])
61
61
  end
62
-
62
+
63
63
  it "should allow adding multiple roles at once" do
64
64
  role = DarDaDa::Role.new(:role1)
65
65
  role.based_on :author, "user"
66
- role.merge_rights_from.should == ([:author, :user])
66
+ expect(role.merge_rights_from).to eql([:author, :user])
67
67
  end
68
68
  end
69
- end
69
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dar_da_da
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Munz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2017-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
33
+ version: '4.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: '3.0'
40
+ version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: sqlite3-ruby
70
+ name: sqlite3
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project: dar_da_da
129
- rubygems_version: 2.2.0
129
+ rubygems_version: 2.6.8
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Roles easy like sunday morning.