cream 0.5.8 → 0.5.9
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 +1 -1
- data/cream.gemspec +1 -1
- data/lib/cream.rb +1 -2
- data/lib/cream/configure/rails.rb +7 -6
- data/spec/cream/configure/rails_spec.rb +12 -6
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.9
|
data/cream.gemspec
CHANGED
data/lib/cream.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
1
|
require 'require_all'
|
3
|
-
|
4
2
|
require 'rails'
|
5
3
|
# require 'devise'
|
6
4
|
require 'devise-links'
|
@@ -15,6 +13,7 @@ require 'sugar-high/alias'
|
|
15
13
|
require 'sugar-high/kind_of'
|
16
14
|
require 'sugar-high/array'
|
17
15
|
|
16
|
+
require 'cream/role'
|
18
17
|
require_all File.dirname(__FILE__) + '/cream/controller'
|
19
18
|
require_all File.dirname(__FILE__) + '/cream/helper'
|
20
19
|
require_all File.dirname(__FILE__) + '/cream/view'
|
@@ -3,12 +3,13 @@ require 'r3_plugin_toolbox'
|
|
3
3
|
|
4
4
|
Rails3::Plugin::Extender.new do
|
5
5
|
# extend action_controller with methods from some modules
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
|
7
|
+
extend_rails :controller do
|
8
|
+
extend_from_module Cream, :role
|
9
|
+
extend_from_module Cream::Controller, :ability
|
10
|
+
extend_from_module Cream::Helper, :role, :local_host, :auth_label
|
11
|
+
extend_from_module Cream::Link, :session, :registration, :rest, :session
|
12
|
+
end
|
12
13
|
|
13
14
|
# extend action_view with methods from some modules
|
14
15
|
extend_rails :view do
|
@@ -16,18 +16,24 @@ require 'cream/role'
|
|
16
16
|
require 'cream/configure'
|
17
17
|
|
18
18
|
describe "Rails extension" do
|
19
|
-
describe '
|
19
|
+
describe 'Extensions' do
|
20
20
|
it "should extend Action View with Roles helper instance_methods and specific role methods" do
|
21
21
|
after_init :view do
|
22
22
|
:view.should be_extended_with Cream::View, :role, :host, :user_action_menu
|
23
23
|
:view.should be_extended_with Cream::Helper, :role
|
24
|
-
# [:admin, :guest].each do |role|
|
25
|
-
# view.should respond_to? :"for_#{role}"
|
26
|
-
# view.should respond_to? :"#{role}_area"
|
27
|
-
# view.should respond_to? :"#{role}?"
|
28
|
-
# end
|
29
24
|
end
|
25
|
+
|
26
|
+
init_app_railties :minimal, :view
|
27
|
+
end
|
30
28
|
|
29
|
+
it "should extend Action Controller" do
|
30
|
+
after_init :controller do
|
31
|
+
:controller.should be_extended_with Cream, :role
|
32
|
+
:controller.should be_extended_with Cream::Controller, :ability
|
33
|
+
:controller.should be_extended_with Cream::Helper, :role, :local_host, :auth_label
|
34
|
+
:controller.should be_extended_with Cream::Link, :session, :registration, :rest, :session
|
35
|
+
end
|
36
|
+
|
31
37
|
init_app_railties :minimal, :view
|
32
38
|
end
|
33
39
|
end
|