releaf-permissions 1.0.10 → 1.1.0

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: 64e2daa005e753bff94a9990a799b2e50d40530b
4
- data.tar.gz: 6a8f100532f01a1cd79ef75b3b8accfe1431e5da
3
+ metadata.gz: 22d4c4ec21dcc37af40f4a7690106ae8a3f291aa
4
+ data.tar.gz: 5f07c3941d2916abe91660513eb0219762c47e6c
5
5
  SHA512:
6
- metadata.gz: f72a310dcdd9ca752e524455bda6d5c0a8f303ab6001f264dacfbd8027051110429c13d6e68b2aea963cffe71247aa93e69c8bc7c5cf0209472c8af912605142
7
- data.tar.gz: 48ba4fffaef9850db30b784823b7431002e9162b5a05fdcfcad820123ea5b27f5238851aa98a06773f75ed375c4db35fe2b990b355c68cd812c9ed0fcf4531fd
6
+ metadata.gz: 3b2c1cd291b89b48777af2112c74c9fcf94c79f45515d4d1fa595cfa669b70d99d52e3490a00ebd6f4ee4435a3aaaa2dbdcc177ecef605c8d1fc08994a2188bd
7
+ data.tar.gz: 984844a5bc126f0e2cbd84e8bec4e0772dc332ca15fe120df4d0b59dcb956ce247d114fa26f7d03be8bd36efac0fca9520845619194ce9c2ab43850a343c050e
@@ -7,11 +7,11 @@ class Releaf::Permissions::Page::LayoutBuilder < Releaf::Builders::Page::LayoutB
7
7
  Releaf::Permissions::Page::MenuBuilder
8
8
  end
9
9
 
10
- def body_content(&block)
10
+ def body_content_blocks
11
11
  if controller.respond_to?(:authorized?) && controller.authorized?
12
12
  super
13
13
  else
14
- yield
14
+ [yield]
15
15
  end
16
16
  end
17
17
  end
@@ -1,4 +1,5 @@
1
1
  class Releaf::Permissions::SessionsController < Devise::SessionsController
2
+ include Releaf::ActionController::Layout
2
3
  layout "releaf/admin"
3
4
  helper_method :page_title
4
5
 
@@ -2,6 +2,7 @@ require "rails_helper"
2
2
 
3
3
  describe Releaf::Permissions::Page::LayoutBuilder, type: :class do
4
4
  class PermissionsLayoutBuilderView < ActionView::Base; end
5
+
5
6
  let(:controller){ Releaf::RootController.new }
6
7
  let(:template){ PermissionsLayoutBuilderView.new }
7
8
  subject { described_class.new(template) }
@@ -26,39 +27,34 @@ describe Releaf::Permissions::Page::LayoutBuilder, type: :class do
26
27
  end
27
28
  end
28
29
 
29
- describe "#body_content" do
30
+ describe "#body_content_blocks" do
30
31
  before do
31
32
  allow(subject).to receive(:header).and_return("_header")
32
33
  allow(subject).to receive(:menu).and_return("_menu")
33
34
  allow(subject).to receive(:notifications).and_return("_notifications")
35
+ allow(subject).to receive(:assets).and_return("_assets_")
34
36
  end
35
37
 
36
38
  context "when controller responds to `authorized?` and `authorized?` call return true" do
37
39
  it "returns `super` content" do
38
40
  allow(controller).to receive(:authorized?).and_return(true)
39
- expect(subject.body_content{ "x" }).to eq("_header_menu<main id=\"main\">x</main>_notifications")
41
+ expect(subject.body_content_blocks{ "x" }).to eq(["_header", "_menu", "<main id=\"main\">x</main>",
42
+ "_notifications", "_assets_"])
40
43
  end
41
44
  end
42
45
 
43
46
  context "when controller responds to `authorized?` and `authorized?` call return false" do
44
47
  it "returns given block content" do
45
48
  allow(controller).to receive(:authorized?).and_return(false)
46
- expect(subject.body_content{ "x" }).to eq("x")
49
+ expect(subject.body_content_blocks{ "x" }).to eq(["x"])
47
50
  end
48
51
  end
49
52
 
50
53
  context "when controller does not responds to `authorized?`" do
51
54
  it "returns given block content" do
52
55
  allow(controller).to receive(:respond_to?).with(:authorized?).and_return(false)
53
- expect(subject.body_content{ "x" }).to eq("x")
56
+ expect(subject.body_content_blocks{ "x" }).to eq(["x"])
54
57
  end
55
58
  end
56
59
  end
57
- #def body_content(&block)
58
- #if controller.respond_to?(:authorized?) && controller.authorized?
59
- #super
60
- #else
61
- #yield
62
- #end
63
- #end
64
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: releaf-permissions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CubeSystems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-22 00:00:00.000000000 Z
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: releaf-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.10
19
+ version: 1.1.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: 1.0.10
26
+ version: 1.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: devise
29
29
  requirement: !ruby/object:Gem::Requirement