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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8304ed69b8fcec17f9f190714e38d3d84e5dfc0747889303120c4d4eb77c8630
4
- data.tar.gz: 2005c166ac8139c6e567c5e19c56ab5d38febc3a596e5a0f30edfd09074dcafb
3
+ metadata.gz: 36ca862d7e8ff0118220ccd598900af6eecb6eef84a5782208f0dece81defbdd
4
+ data.tar.gz: bc323ed8c7627657414d493932100446171a06301ec0bc9374c562c82a9b6cdb
5
5
  SHA512:
6
- metadata.gz: e6184fa5b49ecfba29fcc2825bd4dfcf82f83d4dcad33311bf9b9586cadeb2dfb1475796e1ca21db0bbf04a57dd8093454b88c3c91f41186c9fdfa9119226176
7
- data.tar.gz: 4ff04576a64dd7c50670b74b5bbd2aa27c8a198000c5b3d2fd325b4806e0026bc2de595884818aa975d002c7537c9b91df9680134585dbdafe38374a29f54b44
6
+ metadata.gz: e321ec08266d46edb3c1445ae670950705fc7244614d11a59ebfcd9810f2a6ad567742cb594ea28af8015035a36b00c3cead9913ed2dec79d3f64ade012b194c
7
+ data.tar.gz: f1570000921576e673b7dd04d69ed92744066b1199b8239cb6dabe51a8425be510dda8d27b4d63818e0e0f90e2f3712622455cb76deb47a12254496935321ae8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meta_presenter (0.2.0)
4
+ meta_presenter (0.2.1)
5
5
  actionmailer (>= 4.0)
6
6
  actionpack (>= 4.0)
7
7
 
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`. Then commit changes and tag the commit with the current release number with `git tag -a "vVersionNumberHere" -m "vVersionNumberHere"`. Push the commit with `git push`, then push the tags with `git push origin --tags`. Finally, push the gem with `gem push meta_presenter-version-number-here.gem`.
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
@@ -33,7 +33,7 @@ module MetaPresenter
33
33
  # @param *args method name and the other arguments
34
34
  def respond_to_missing?(*args)
35
35
  method_name = args.first
36
- delegates_controller_method? || super
36
+ delegates_controller_method?(method_name) || super
37
37
  end
38
38
 
39
39
  private
@@ -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
- if block_given?
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
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'meta_presenter'
5
- s.version = '0.2.0'
5
+ s.version = '0.2.1'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ['szTheory']
8
- s.description = %q{Presenter pattern in your Rails controllers and actions}
9
- s.summary = %q{MetaPresenter is a Ruby gem that gives you access to the powerful presenter pattern in your Rails controllers. 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 small, tight, classes that are easily testable. There's even a DSL for method delegation on objects to reduce boilerplate.}
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.0
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: Presenter pattern in your Rails controllers and actions
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 that gives you access to the powerful presenter
210
- pattern in your Rails controllers. For each controller/action pair you get a presenter
211
- class in `app/presenters` that you can use in your views with with `presenter.method_name`.
212
- This helps you decompose your helper logic into small, tight, classes that are easily
213
- testable. There's even a DSL for method delegation on objects to reduce boilerplate.
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