meta_presenter 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/meta_presenter/base/delegate_to_controller.rb +1 -1
- data/lib/meta_presenter/builder.rb +1 -5
- data/meta_presenter.gemspec +3 -3
- data/spec/meta_presenter/base/delegate_to_controller_spec.rb +3 -0
- data/spec/meta_presenter/helpers_spec.rb +4 -4
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36ca862d7e8ff0118220ccd598900af6eecb6eef84a5782208f0dece81defbdd
|
4
|
+
data.tar.gz: bc323ed8c7627657414d493932100446171a06301ec0bc9374c562c82a9b6cdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e321ec08266d46edb3c1445ae670950705fc7244614d11a59ebfcd9810f2a6ad567742cb594ea28af8015035a36b00c3cead9913ed2dec79d3f64ade012b194c
|
7
|
+
data.tar.gz: f1570000921576e673b7dd04d69ed92744066b1199b8239cb6dabe51a8425be510dda8d27b4d63818e0e0f90e2f3712622455cb76deb47a12254496935321ae8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -204,7 +204,7 @@ MetaPresenter supports Ruby >= 2.1 and ActionPack/ActionMailer >= 4.0. If you'd
|
|
204
204
|
To run the specs for the currently running Ruby version, run `bundle install` and then `bundle exec rspec`. To run specs for every supported version of ActionPack, run `bundle exec appraisal install` and then `bundle exec appraisal rspec`.
|
205
205
|
|
206
206
|
## Gem release
|
207
|
-
Make sure the specs pass, bump the version number in meta_presenter.gemspec, build the gem with `gem build meta_presenter.gemspec`.
|
207
|
+
Make sure the specs pass, bump the version number in meta_presenter.gemspec, build the gem with `gem build meta_presenter.gemspec`. Commit your changes and push to Github, then tag the commit with the current release number using Github's Releases interface (use the format vx.x.x, where x is the semantic version number). You can pull the latest tags to your local repo with `git pull --tags`. Finally, push the gem with `gem push meta_presenter-version-number-here.gem`.
|
208
208
|
|
209
209
|
## TODO
|
210
210
|
* create an example app and link to the repo for it in this README
|
@@ -123,11 +123,7 @@ module MetaPresenter
|
|
123
123
|
ancestors_list = all_ancestors[0..all_ancestors.index(until_class)]
|
124
124
|
|
125
125
|
# map to the fully qualified class name
|
126
|
-
|
127
|
-
ancestors_list.map { |klass| yield(klass) }
|
128
|
-
else
|
129
|
-
ancestors_list
|
130
|
-
end
|
126
|
+
ancestors_list.map { |klass| yield(klass) }
|
131
127
|
end
|
132
128
|
end
|
133
129
|
end
|
data/meta_presenter.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'meta_presenter'
|
5
|
-
s.version = '0.2.
|
5
|
+
s.version = '0.2.1'
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
s.authors = ['szTheory']
|
8
|
-
s.description = %q{
|
9
|
-
s.summary = %q{MetaPresenter is a Ruby gem
|
8
|
+
s.description = %q{Write highly focused and testable view presenter classes for your Rails controllers and actions}
|
9
|
+
s.summary = %q{MetaPresenter is a Ruby gem for writing highly focused and testable view Rails presenter classes. For each controller/action pair you get a presenter class in app/presenters that you can use in your views with with presenter.method_name. This helps you decompose your helper logic into tight, easily testable classes. There's even a DSL for method delegation on objects to reduce boilerplate.}
|
10
10
|
s.homepage = 'https://github.com/szTheory/meta_presenter'
|
11
11
|
s.license = 'MIT'
|
12
12
|
s.metadata = {
|
@@ -30,6 +30,7 @@ describe MetaPresenter::Base::DelegateToController do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it { is_expected.to eql("pages controller method return value") }
|
33
|
+
it { expect(presenter).to respond_to(method_name) }
|
33
34
|
end
|
34
35
|
|
35
36
|
context "on a superclass" do
|
@@ -41,6 +42,7 @@ describe MetaPresenter::Base::DelegateToController do
|
|
41
42
|
end
|
42
43
|
|
43
44
|
it { is_expected.to eql("application controller method return value") }
|
45
|
+
it { expect(presenter).to respond_to(method_name) }
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
@@ -53,6 +55,7 @@ describe MetaPresenter::Base::DelegateToController do
|
|
53
55
|
end
|
54
56
|
|
55
57
|
it { expect { subject }.to raise_error(NoMethodError) }
|
58
|
+
it { expect(presenter).to_not respond_to(method_name) }
|
56
59
|
end
|
57
60
|
end
|
58
61
|
end
|
@@ -5,13 +5,13 @@ describe MetaPresenter::Helpers do
|
|
5
5
|
let(:controller) { controller_class.new }
|
6
6
|
let(:action_name) { 'logs' }
|
7
7
|
|
8
|
+
before do
|
9
|
+
allow(controller).to receive(:action_name).and_return(action_name)
|
10
|
+
end
|
11
|
+
|
8
12
|
describe '#presenter' do
|
9
13
|
subject { controller.view_context.presenter }
|
10
14
|
|
11
|
-
before do
|
12
|
-
allow(controller).to receive(:action_name).and_return(action_name)
|
13
|
-
end
|
14
|
-
|
15
15
|
context "controller with this module included" do
|
16
16
|
before do
|
17
17
|
expect(controller_class.included_modules).to include(described_class)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta_presenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- szTheory
|
@@ -136,7 +136,8 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description:
|
139
|
+
description: Write highly focused and testable view presenter classes for your Rails
|
140
|
+
controllers and actions
|
140
141
|
email:
|
141
142
|
executables: []
|
142
143
|
extensions: []
|
@@ -206,11 +207,11 @@ rubyforge_project:
|
|
206
207
|
rubygems_version: 2.7.6
|
207
208
|
signing_key:
|
208
209
|
specification_version: 4
|
209
|
-
summary: MetaPresenter is a Ruby gem
|
210
|
-
|
211
|
-
|
212
|
-
This helps you decompose your helper logic into
|
213
|
-
|
210
|
+
summary: MetaPresenter is a Ruby gem for writing highly focused and testable view
|
211
|
+
Rails presenter classes. For each controller/action pair you get a presenter class
|
212
|
+
in app/presenters that you can use in your views with with presenter.method_name.
|
213
|
+
This helps you decompose your helper logic into tight, easily testable classes.
|
214
|
+
There's even a DSL for method delegation on objects to reduce boilerplate.
|
214
215
|
test_files:
|
215
216
|
- spec/meta_presenter/base/delegate_all_to_spec.rb
|
216
217
|
- spec/meta_presenter/base/delegate_to_controller_spec.rb
|