strong_presenter 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +14 -6
- data/README.md +107 -30
- data/lib/strong_presenter/associable.rb +47 -7
- data/lib/strong_presenter/collection_presenter.rb +16 -0
- data/lib/strong_presenter/permissible.rb +9 -32
- data/lib/strong_presenter/permissions.rb +78 -75
- data/lib/strong_presenter/presenter.rb +2 -3
- data/lib/strong_presenter/presenter_helper_constructor.rb +1 -1
- data/lib/strong_presenter/version.rb +1 -1
- data/spec/dummy/app/controllers/posts_controller.rb +1 -1
- data/spec/dummy/app/mailers/post_mailer.rb +1 -1
- data/spec/strong_presenter/associable_spec.rb +197 -18
- data/spec/strong_presenter/collection_presenter_spec.rb +38 -6
- data/spec/strong_presenter/controller_additions_spec.rb +115 -0
- data/spec/strong_presenter/helper_proxy_spec.rb +53 -0
- data/spec/strong_presenter/permissible_spec.rb +6 -6
- data/spec/strong_presenter/permissions_spec.rb +81 -67
- data/spec/strong_presenter/presenter_spec.rb +83 -1
- data/spec/strong_presenter/view_context/build_strategy_spec.rb +116 -0
- data/spec/strong_presenter/view_context_spec.rb +154 -0
- data/spec/strong_presenter/view_helpers_spec.rb +8 -0
- data/spec/support/shared_examples/view_helpers.rb +39 -0
- data/strong_presenter.gemspec +2 -2
- metadata +74 -100
- checksums.yaml +0 -7
@@ -1,7 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'support/shared_examples/view_helpers'
|
2
3
|
|
3
4
|
module StrongPresenter
|
4
5
|
describe Presenter do
|
6
|
+
it_behaves_like "view helpers", Presenter.new(Model.new)
|
7
|
+
|
5
8
|
describe "#initialize" do
|
6
9
|
it "sets the object" do
|
7
10
|
object = Model.new
|
@@ -20,7 +23,80 @@ module StrongPresenter
|
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
23
|
-
describe "
|
26
|
+
describe "ActiveModel compatibility" do
|
27
|
+
protect_class(Product)
|
28
|
+
|
29
|
+
before(:each) do
|
30
|
+
@product_presenter = ProductPresenter.new(Product.new)
|
31
|
+
end
|
32
|
+
|
33
|
+
it '#to_model' do
|
34
|
+
expect(@product_presenter.to_model).to be @product_presenter
|
35
|
+
end
|
36
|
+
|
37
|
+
it '#to_param' do
|
38
|
+
Product.send(:define_method, :to_param) {123}
|
39
|
+
expect(@product_presenter.to_param).to be 123
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#to_partial_path' do
|
43
|
+
Product.send(:define_method, :to_partial_path) {'/product!/'}
|
44
|
+
expect(@product_presenter.to_partial_path).to eq '/product!/'
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#attributes' do
|
48
|
+
protect_class(CarPresenter)
|
49
|
+
before(:each) do
|
50
|
+
car = Car.new
|
51
|
+
car.license_plate = "IMHERE"
|
52
|
+
@car_presenter = CarPresenter.new(car)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'is initially empty' do
|
56
|
+
expect(@car_presenter.attributes).to be_empty
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'shows associations' do
|
60
|
+
CarPresenter.send(:define_method, :license_plate) { object.license_plate }
|
61
|
+
expect(@car_presenter.attributes).to eq({"license_plate" => "IMHERE"})
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "Unconventional name" do
|
67
|
+
before(:each) do
|
68
|
+
stub_const('StrangePresent', Class.new(StrongPresenter::Presenter))
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'has no object class' do
|
72
|
+
expect(StrangePresent.send :object_class?).to be_false
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'raises source error' do
|
76
|
+
expect{StrangePresent.send :object_class}.to raise_error(StrongPresenter::UninferrableSourceError)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'can set present' do
|
80
|
+
StrangePresent.send(:presents, :car)
|
81
|
+
expect(StrangePresent.send :object_class).to be Car
|
82
|
+
presenter = StrangePresent.new(Car.new)
|
83
|
+
expect(StrangePresent.model_name).to be Car.model_name
|
84
|
+
expect(presenter.send(:car)).to be presenter.send(:object)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "::presents" do
|
89
|
+
protect_class(ProductPresenter)
|
90
|
+
|
91
|
+
it 'handles inferred case' do
|
92
|
+
ProductPresenter.send(:presents, :product)
|
93
|
+
expect(ProductPresenter.send :object_class).to be Product
|
94
|
+
product_presenter = ProductPresenter.new(Product.new)
|
95
|
+
expect(product_presenter.send(:product)).to be product_presenter.send(:object)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "::Collection" do
|
24
100
|
it "finds corresponding collection presenter" do
|
25
101
|
expect(ProductPresenter::Collection).to be ProductsPresenter
|
26
102
|
end
|
@@ -38,6 +114,12 @@ module StrongPresenter
|
|
38
114
|
it "infers presenter on collection presenter" do
|
39
115
|
expect(ProductPresenter::Collection.send :presenter_class).to be ProductPresenter
|
40
116
|
end
|
117
|
+
|
118
|
+
it "uses correct collection with chained inheritance" do
|
119
|
+
stub_const("NewProductPresenter", Class.new(ProductPresenter))
|
120
|
+
|
121
|
+
expect(NewProductPresenter::Collection.send :presenter_class).to be NewProductPresenter
|
122
|
+
end
|
41
123
|
end
|
42
124
|
end
|
43
125
|
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
def fake_view_context
|
4
|
+
double("ViewContext")
|
5
|
+
end
|
6
|
+
|
7
|
+
def fake_controller(view_context = fake_view_context)
|
8
|
+
double("Controller", view_context: view_context, request: double("Request"))
|
9
|
+
end
|
10
|
+
|
11
|
+
module StrongPresenter
|
12
|
+
describe ViewContext::BuildStrategy::Full do
|
13
|
+
describe "#call" do
|
14
|
+
context "when a current controller is set" do
|
15
|
+
it "returns the controller's view context" do
|
16
|
+
view_context = fake_view_context
|
17
|
+
ViewContext.stub controller: fake_controller(view_context)
|
18
|
+
strategy = ViewContext::BuildStrategy::Full.new
|
19
|
+
|
20
|
+
expect(strategy.call).to be view_context
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context "when a current controller is not set" do
|
25
|
+
it "uses ApplicationController" do
|
26
|
+
view_context = fake_view_context
|
27
|
+
stub_const "ApplicationController", double(new: fake_controller(view_context))
|
28
|
+
strategy = ViewContext::BuildStrategy::Full.new
|
29
|
+
|
30
|
+
expect(strategy.call).to be view_context
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "adds a request if one is not defined" do
|
35
|
+
controller = Class.new(ActionController::Base).new
|
36
|
+
ViewContext.stub controller: controller
|
37
|
+
strategy = ViewContext::BuildStrategy::Full.new
|
38
|
+
|
39
|
+
expect(controller.request).to be_nil
|
40
|
+
strategy.call
|
41
|
+
expect(controller.request).to be_an ActionController::TestRequest
|
42
|
+
expect(controller.params).to eq({})
|
43
|
+
|
44
|
+
# sanity checks
|
45
|
+
expect(controller.view_context.request).to be controller.request
|
46
|
+
expect(controller.view_context.params).to be controller.params
|
47
|
+
end
|
48
|
+
|
49
|
+
it "adds methods to the view context from the constructor block" do
|
50
|
+
ViewContext.stub controller: fake_controller
|
51
|
+
strategy = ViewContext::BuildStrategy::Full.new do
|
52
|
+
def a_helper_method; end
|
53
|
+
end
|
54
|
+
|
55
|
+
expect(strategy.call).to respond_to :a_helper_method
|
56
|
+
end
|
57
|
+
|
58
|
+
it "includes modules into the view context from the constructor block" do
|
59
|
+
view_context = Object.new
|
60
|
+
ViewContext.stub controller: fake_controller(view_context)
|
61
|
+
helpers = Module.new do
|
62
|
+
def a_helper_method; end
|
63
|
+
end
|
64
|
+
strategy = ViewContext::BuildStrategy::Full.new do
|
65
|
+
include helpers
|
66
|
+
end
|
67
|
+
|
68
|
+
expect(strategy.call).to respond_to :a_helper_method
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe ViewContext::BuildStrategy::Fast do
|
74
|
+
describe "#call" do
|
75
|
+
it "returns an instance of a subclass of ActionView::Base" do
|
76
|
+
strategy = ViewContext::BuildStrategy::Fast.new
|
77
|
+
|
78
|
+
returned = strategy.call
|
79
|
+
|
80
|
+
expect(returned).to be_an ActionView::Base
|
81
|
+
expect(returned.class).not_to be ActionView::Base
|
82
|
+
end
|
83
|
+
|
84
|
+
it "returns different instances each time" do
|
85
|
+
strategy = ViewContext::BuildStrategy::Fast.new
|
86
|
+
|
87
|
+
expect(strategy.call).not_to be strategy.call
|
88
|
+
end
|
89
|
+
|
90
|
+
it "returns the same subclass each time" do
|
91
|
+
strategy = ViewContext::BuildStrategy::Fast.new
|
92
|
+
|
93
|
+
expect(strategy.call.class).to be strategy.call.class
|
94
|
+
end
|
95
|
+
|
96
|
+
it "adds methods to the view context from the constructor block" do
|
97
|
+
strategy = ViewContext::BuildStrategy::Fast.new do
|
98
|
+
def a_helper_method; end
|
99
|
+
end
|
100
|
+
|
101
|
+
expect(strategy.call).to respond_to :a_helper_method
|
102
|
+
end
|
103
|
+
|
104
|
+
it "includes modules into the view context from the constructor block" do
|
105
|
+
helpers = Module.new do
|
106
|
+
def a_helper_method; end
|
107
|
+
end
|
108
|
+
strategy = ViewContext::BuildStrategy::Fast.new do
|
109
|
+
include helpers
|
110
|
+
end
|
111
|
+
|
112
|
+
expect(strategy.call).to respond_to :a_helper_method
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module StrongPresenter
|
4
|
+
describe ViewContext do
|
5
|
+
describe "#view_context" do
|
6
|
+
let(:base) { Class.new { def view_context; :controller_view_context; end } }
|
7
|
+
let(:controller) { Class.new(base) { include ViewContext } }
|
8
|
+
|
9
|
+
it "saves the superclass's view context" do
|
10
|
+
ViewContext.should_receive(:current=).with(:controller_view_context)
|
11
|
+
controller.new.view_context
|
12
|
+
end
|
13
|
+
|
14
|
+
it "returns the superclass's view context" do
|
15
|
+
expect(controller.new.view_context).to be :controller_view_context
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe ".controller" do
|
20
|
+
it "returns the stored controller from RequestStore" do
|
21
|
+
RequestStore.stub store: {current_controller: :stored_controller}
|
22
|
+
|
23
|
+
expect(ViewContext.controller).to be :stored_controller
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe ".controller=" do
|
28
|
+
it "stores a controller in RequestStore" do
|
29
|
+
store = {}
|
30
|
+
RequestStore.stub store: store
|
31
|
+
|
32
|
+
ViewContext.controller = :stored_controller
|
33
|
+
expect(store[:current_controller]).to be :stored_controller
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe ".current" do
|
38
|
+
it "returns the stored view context from RequestStore" do
|
39
|
+
RequestStore.stub store: {current_view_context: :stored_view_context}
|
40
|
+
|
41
|
+
expect(ViewContext.current).to be :stored_view_context
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when no view context is stored" do
|
45
|
+
it "builds a view context" do
|
46
|
+
RequestStore.stub store: {}
|
47
|
+
ViewContext.stub build_strategy: ->{ :new_view_context }
|
48
|
+
HelperProxy.stub(:new).with(:new_view_context).and_return(:new_helper_proxy)
|
49
|
+
|
50
|
+
expect(ViewContext.current).to be :new_helper_proxy
|
51
|
+
end
|
52
|
+
|
53
|
+
it "stores the built view context" do
|
54
|
+
store = {}
|
55
|
+
RequestStore.stub store: store
|
56
|
+
ViewContext.stub build_strategy: ->{ :new_view_context }
|
57
|
+
HelperProxy.stub(:new).with(:new_view_context).and_return(:new_helper_proxy)
|
58
|
+
|
59
|
+
ViewContext.current
|
60
|
+
expect(store[:current_view_context]).to be :new_helper_proxy
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe ".current=" do
|
66
|
+
it "stores a helper proxy for the view context in RequestStore" do
|
67
|
+
store = {}
|
68
|
+
RequestStore.stub store: store
|
69
|
+
HelperProxy.stub(:new).with(:stored_view_context).and_return(:stored_helper_proxy)
|
70
|
+
|
71
|
+
ViewContext.current = :stored_view_context
|
72
|
+
expect(store[:current_view_context]).to be :stored_helper_proxy
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe ".clear!" do
|
77
|
+
it "clears the stored controller and view controller" do
|
78
|
+
store = {current_controller: :stored_controller, current_view_context: :stored_view_context}
|
79
|
+
RequestStore.stub store: store
|
80
|
+
|
81
|
+
ViewContext.clear!
|
82
|
+
expect(store).not_to have_key :current_controller
|
83
|
+
expect(store).not_to have_key :current_view_context
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe ".build" do
|
88
|
+
it "returns a new view context using the build strategy" do
|
89
|
+
ViewContext.stub build_strategy: ->{ :new_view_context }
|
90
|
+
|
91
|
+
expect(ViewContext.build).to be :new_view_context
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe ".build!" do
|
96
|
+
it "returns a helper proxy for the new view context" do
|
97
|
+
ViewContext.stub build_strategy: ->{ :new_view_context }
|
98
|
+
HelperProxy.stub(:new).with(:new_view_context).and_return(:new_helper_proxy)
|
99
|
+
|
100
|
+
expect(ViewContext.build!).to be :new_helper_proxy
|
101
|
+
end
|
102
|
+
|
103
|
+
it "stores the helper proxy" do
|
104
|
+
store = {}
|
105
|
+
RequestStore.stub store: store
|
106
|
+
ViewContext.stub build_strategy: ->{ :new_view_context }
|
107
|
+
HelperProxy.stub(:new).with(:new_view_context).and_return(:new_helper_proxy)
|
108
|
+
|
109
|
+
ViewContext.build!
|
110
|
+
expect(store[:current_view_context]).to be :new_helper_proxy
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe ".build_strategy" do
|
115
|
+
it "defaults to full" do
|
116
|
+
expect(ViewContext.build_strategy).to be_a ViewContext::BuildStrategy::Full
|
117
|
+
end
|
118
|
+
|
119
|
+
it "memoizes" do
|
120
|
+
expect(ViewContext.build_strategy).to be ViewContext.build_strategy
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe ".test_strategy" do
|
125
|
+
protect_module ViewContext
|
126
|
+
|
127
|
+
context "with :fast" do
|
128
|
+
it "creates a fast strategy" do
|
129
|
+
ViewContext.test_strategy :fast
|
130
|
+
expect(ViewContext.build_strategy).to be_a ViewContext::BuildStrategy::Fast
|
131
|
+
end
|
132
|
+
|
133
|
+
it "passes a block to the strategy" do
|
134
|
+
ViewContext::BuildStrategy::Fast.stub(:new).and_return{|&block| block.call}
|
135
|
+
|
136
|
+
expect(ViewContext.test_strategy(:fast){:passed}).to be :passed
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context "with :full" do
|
141
|
+
it "creates a full strategy" do
|
142
|
+
ViewContext.test_strategy :full
|
143
|
+
expect(ViewContext.build_strategy).to be_a ViewContext::BuildStrategy::Full
|
144
|
+
end
|
145
|
+
|
146
|
+
it "passes a block to the strategy" do
|
147
|
+
ViewContext::BuildStrategy::Full.stub(:new).and_return{|&block| block.call}
|
148
|
+
|
149
|
+
expect(ViewContext.test_strategy(:full){:passed}).to be :passed
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
shared_examples_for "view helpers" do |subject|
|
2
|
+
describe "#helpers" do
|
3
|
+
it "returns the current view context" do
|
4
|
+
StrongPresenter::ViewContext.stub current: :current_view_context
|
5
|
+
expect(subject.helpers).to be :current_view_context
|
6
|
+
end
|
7
|
+
|
8
|
+
it "is aliased to #h" do
|
9
|
+
StrongPresenter::ViewContext.stub current: :current_view_context
|
10
|
+
expect(subject.h).to be :current_view_context
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#localize" do
|
15
|
+
it "delegates to #helpers" do
|
16
|
+
subject.stub helpers: double
|
17
|
+
subject.helpers.should_receive(:localize).with(:an_object, some: "parameter")
|
18
|
+
subject.localize(:an_object, some: "parameter")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "is aliased to #l" do
|
22
|
+
subject.stub helpers: double
|
23
|
+
subject.helpers.should_receive(:localize).with(:an_object, some: "parameter")
|
24
|
+
subject.l(:an_object, some: "parameter")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ".helpers" do
|
29
|
+
it "returns the current view context" do
|
30
|
+
StrongPresenter::ViewContext.stub current: :current_view_context
|
31
|
+
expect(subject.class.helpers).to be :current_view_context
|
32
|
+
end
|
33
|
+
|
34
|
+
it "is aliased to .h" do
|
35
|
+
StrongPresenter::ViewContext.stub current: :current_view_context
|
36
|
+
expect(subject.class.h).to be :current_view_context
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/strong_presenter.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.version = StrongPresenter::VERSION
|
9
9
|
gem.authors = ["Ronald Chan"]
|
10
10
|
gem.email = ["ronalchn@gmail.com"]
|
11
|
-
gem.description = %q{strong_presenter
|
12
|
-
gem.summary = %q{strong_presenter
|
11
|
+
gem.description = %q{strong_presenter adds a layer of presentation logic to your application, and gives you strong_parameters-like logic to determine which attributes are visible}
|
12
|
+
gem.summary = %q{strong_presenter adds a layer of presentation logic to your application, and gives you strong_parameters-like logic to determine which attributes are visible}
|
13
13
|
gem.homepage = "https://github.com/ronalchn/strong_presenter"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,200 +1,161 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Ronald Chan
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &14932020 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '3.0'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
|
-
version_requirements:
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '3.0'
|
24
|
+
version_requirements: *14932020
|
27
25
|
- !ruby/object:Gem::Dependency
|
28
26
|
name: actionpack
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &14930040 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
30
29
|
requirements:
|
31
|
-
- - '>='
|
30
|
+
- - ! '>='
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '3.0'
|
34
33
|
type: :runtime
|
35
34
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.0'
|
35
|
+
version_requirements: *14930040
|
41
36
|
- !ruby/object:Gem::Dependency
|
42
37
|
name: request_store
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &14928360 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
44
40
|
requirements:
|
45
41
|
- - ~>
|
46
42
|
- !ruby/object:Gem::Version
|
47
43
|
version: 1.0.3
|
48
44
|
type: :runtime
|
49
45
|
prerelease: false
|
50
|
-
version_requirements:
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0.3
|
46
|
+
version_requirements: *14928360
|
55
47
|
- !ruby/object:Gem::Dependency
|
56
48
|
name: activemodel
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &14947960 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
58
51
|
requirements:
|
59
|
-
- - '>='
|
52
|
+
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '3.0'
|
62
55
|
type: :runtime
|
63
56
|
prerelease: false
|
64
|
-
version_requirements:
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
57
|
+
version_requirements: *14947960
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
59
|
name: ammeter
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &14945820 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
72
62
|
requirements:
|
73
|
-
- - '>='
|
63
|
+
- - ! '>='
|
74
64
|
- !ruby/object:Gem::Version
|
75
65
|
version: '0'
|
76
66
|
type: :development
|
77
67
|
prerelease: false
|
78
|
-
version_requirements:
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
68
|
+
version_requirements: *14945820
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rake
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &14944620 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
86
73
|
requirements:
|
87
|
-
- - '>='
|
74
|
+
- - ! '>='
|
88
75
|
- !ruby/object:Gem::Version
|
89
76
|
version: 0.9.2
|
90
77
|
type: :development
|
91
78
|
prerelease: false
|
92
|
-
version_requirements:
|
93
|
-
requirements:
|
94
|
-
- - '>='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.9.2
|
79
|
+
version_requirements: *14944620
|
97
80
|
- !ruby/object:Gem::Dependency
|
98
81
|
name: rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirement: &14942300 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
100
84
|
requirements:
|
101
85
|
- - ~>
|
102
86
|
- !ruby/object:Gem::Version
|
103
87
|
version: '2.12'
|
104
88
|
type: :development
|
105
89
|
prerelease: false
|
106
|
-
version_requirements:
|
107
|
-
requirements:
|
108
|
-
- - ~>
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '2.12'
|
90
|
+
version_requirements: *14942300
|
111
91
|
- !ruby/object:Gem::Dependency
|
112
92
|
name: rspec-mocks
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirement: &14955380 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
114
95
|
requirements:
|
115
|
-
- - '>='
|
96
|
+
- - ! '>='
|
116
97
|
- !ruby/object:Gem::Version
|
117
98
|
version: 2.12.1
|
118
99
|
type: :development
|
119
100
|
prerelease: false
|
120
|
-
version_requirements:
|
121
|
-
requirements:
|
122
|
-
- - '>='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 2.12.1
|
101
|
+
version_requirements: *14955380
|
125
102
|
- !ruby/object:Gem::Dependency
|
126
103
|
name: rspec-rails
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirement: &14952840 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
128
106
|
requirements:
|
129
107
|
- - ~>
|
130
108
|
- !ruby/object:Gem::Version
|
131
109
|
version: '2.12'
|
132
110
|
type: :development
|
133
111
|
prerelease: false
|
134
|
-
version_requirements:
|
135
|
-
requirements:
|
136
|
-
- - ~>
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '2.12'
|
112
|
+
version_requirements: *14952840
|
139
113
|
- !ruby/object:Gem::Dependency
|
140
114
|
name: minitest-rails
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirement: &14951520 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
142
117
|
requirements:
|
143
118
|
- - ~>
|
144
119
|
- !ruby/object:Gem::Version
|
145
120
|
version: '0.2'
|
146
121
|
type: :development
|
147
122
|
prerelease: false
|
148
|
-
version_requirements:
|
149
|
-
requirements:
|
150
|
-
- - ~>
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0.2'
|
123
|
+
version_requirements: *14951520
|
153
124
|
- !ruby/object:Gem::Dependency
|
154
125
|
name: capybara
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirement: &14950540 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
156
128
|
requirements:
|
157
|
-
- - '>='
|
129
|
+
- - ! '>='
|
158
130
|
- !ruby/object:Gem::Version
|
159
131
|
version: '0'
|
160
132
|
type: :development
|
161
133
|
prerelease: false
|
162
|
-
version_requirements:
|
163
|
-
requirements:
|
164
|
-
- - '>='
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
134
|
+
version_requirements: *14950540
|
167
135
|
- !ruby/object:Gem::Dependency
|
168
136
|
name: active_model_serializers
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
137
|
+
requirement: &14974320 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
170
139
|
requirements:
|
171
|
-
- - '>='
|
140
|
+
- - ! '>='
|
172
141
|
- !ruby/object:Gem::Version
|
173
142
|
version: '0'
|
174
143
|
type: :development
|
175
144
|
prerelease: false
|
176
|
-
version_requirements:
|
177
|
-
requirements:
|
178
|
-
- - '>='
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
145
|
+
version_requirements: *14974320
|
181
146
|
- !ruby/object:Gem::Dependency
|
182
147
|
name: activerecord
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirement: &14972800 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
184
150
|
requirements:
|
185
|
-
- - '>='
|
151
|
+
- - ! '>='
|
186
152
|
- !ruby/object:Gem::Version
|
187
153
|
version: '3.0'
|
188
154
|
type: :development
|
189
155
|
prerelease: false
|
190
|
-
version_requirements:
|
191
|
-
|
192
|
-
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '3.0'
|
195
|
-
description: strong_presenter lets you add presenters to your application, along with
|
196
|
-
strong_parameters-inspired permit logic to handle mass presentations, where each
|
197
|
-
user may have permision to view different fields
|
156
|
+
version_requirements: *14972800
|
157
|
+
description: strong_presenter adds a layer of presentation logic to your application,
|
158
|
+
and gives you strong_parameters-like logic to determine which attributes are visible
|
198
159
|
email:
|
199
160
|
- ronalchn@gmail.com
|
200
161
|
executables: []
|
@@ -321,41 +282,47 @@ files:
|
|
321
282
|
- spec/spec_helper.rb
|
322
283
|
- spec/strong_presenter/associable_spec.rb
|
323
284
|
- spec/strong_presenter/collection_presenter_spec.rb
|
285
|
+
- spec/strong_presenter/controller_additions_spec.rb
|
324
286
|
- spec/strong_presenter/delegation_spec.rb
|
287
|
+
- spec/strong_presenter/helper_proxy_spec.rb
|
325
288
|
- spec/strong_presenter/permissible_spec.rb
|
326
289
|
- spec/strong_presenter/permissions_spec.rb
|
327
290
|
- spec/strong_presenter/presenter_spec.rb
|
328
291
|
- spec/strong_presenter/simplecov_spec.rb
|
292
|
+
- spec/strong_presenter/view_context/build_strategy_spec.rb
|
293
|
+
- spec/strong_presenter/view_context_spec.rb
|
294
|
+
- spec/strong_presenter/view_helpers_spec.rb
|
329
295
|
- spec/support/dummy_app.rb
|
330
296
|
- spec/support/matchers/have_text.rb
|
331
297
|
- spec/support/models.rb
|
332
298
|
- spec/support/schema.rb
|
299
|
+
- spec/support/shared_examples/view_helpers.rb
|
333
300
|
- strong_presenter.gemspec
|
334
301
|
homepage: https://github.com/ronalchn/strong_presenter
|
335
302
|
licenses: []
|
336
|
-
metadata: {}
|
337
303
|
post_install_message:
|
338
304
|
rdoc_options: []
|
339
305
|
require_paths:
|
340
306
|
- lib
|
341
307
|
required_ruby_version: !ruby/object:Gem::Requirement
|
308
|
+
none: false
|
342
309
|
requirements:
|
343
|
-
- - '>='
|
310
|
+
- - ! '>='
|
344
311
|
- !ruby/object:Gem::Version
|
345
312
|
version: '0'
|
346
313
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
314
|
+
none: false
|
347
315
|
requirements:
|
348
|
-
- - '>='
|
316
|
+
- - ! '>='
|
349
317
|
- !ruby/object:Gem::Version
|
350
318
|
version: '0'
|
351
319
|
requirements: []
|
352
320
|
rubyforge_project:
|
353
|
-
rubygems_version:
|
321
|
+
rubygems_version: 1.8.17
|
354
322
|
signing_key:
|
355
|
-
specification_version:
|
356
|
-
summary: strong_presenter
|
357
|
-
strong_parameters-
|
358
|
-
user may have permision to view different fields
|
323
|
+
specification_version: 3
|
324
|
+
summary: strong_presenter adds a layer of presentation logic to your application,
|
325
|
+
and gives you strong_parameters-like logic to determine which attributes are visible
|
359
326
|
test_files:
|
360
327
|
- spec/dummy/.rspec
|
361
328
|
- spec/dummy/Rakefile
|
@@ -429,12 +396,19 @@ test_files:
|
|
429
396
|
- spec/spec_helper.rb
|
430
397
|
- spec/strong_presenter/associable_spec.rb
|
431
398
|
- spec/strong_presenter/collection_presenter_spec.rb
|
399
|
+
- spec/strong_presenter/controller_additions_spec.rb
|
432
400
|
- spec/strong_presenter/delegation_spec.rb
|
401
|
+
- spec/strong_presenter/helper_proxy_spec.rb
|
433
402
|
- spec/strong_presenter/permissible_spec.rb
|
434
403
|
- spec/strong_presenter/permissions_spec.rb
|
435
404
|
- spec/strong_presenter/presenter_spec.rb
|
436
405
|
- spec/strong_presenter/simplecov_spec.rb
|
406
|
+
- spec/strong_presenter/view_context/build_strategy_spec.rb
|
407
|
+
- spec/strong_presenter/view_context_spec.rb
|
408
|
+
- spec/strong_presenter/view_helpers_spec.rb
|
437
409
|
- spec/support/dummy_app.rb
|
438
410
|
- spec/support/matchers/have_text.rb
|
439
411
|
- spec/support/models.rb
|
440
412
|
- spec/support/schema.rb
|
413
|
+
- spec/support/shared_examples/view_helpers.rb
|
414
|
+
has_rdoc:
|