r_decorator 0.0.4 → 0.0.5

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.
@@ -59,7 +59,11 @@ module RDecorator
59
59
  def self.target_to_class(target, ignore_missing = false)
60
60
  case target
61
61
  when String, Symbol
62
- klass = target.to_s.camelize.safe_constantize
62
+ begin
63
+ target = target.to_s.camelize
64
+ klass = target.constantize
65
+ rescue NameError
66
+ end
63
67
  else
64
68
  klass = target
65
69
  end
@@ -0,0 +1,7 @@
1
+ module RDecorator
2
+ class Engine < ::Rails::Engine
3
+ config.after_initialize do
4
+ Dir[ File.join( Rails.root, "app", "decorators", "**", "*.rb" ) ].each {|f| require_dependency f}
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module RDecorator
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/r_decorator.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require 'r_decorator/version'
2
2
  require 'r_decorator/base'
3
- require 'r_decorator/railtie'
3
+ require 'r_decorator/railtie'
4
+ require 'r_decorator/engine'
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'view_context on rspec' do
4
- let(:author) { Author.create(name: 'test') }
4
+ let(:author) { Author.create( :name => 'test') }
5
5
  subject { author.decorated }
6
6
  its(:name_link) { should be_html_safe }
7
7
  end
@@ -37,7 +37,7 @@ class ApplicationDecorator < RDecorator::Base
37
37
  end
38
38
  class AuthorDecorator < ApplicationDecorator
39
39
  def name_link
40
- link_to origin.name, author_path(origin), title: origin.name
40
+ link_to origin.name, author_path(origin), :id => origin.name
41
41
  end
42
42
 
43
43
  def reverse_name
@@ -8,7 +8,6 @@ feature 'fallback to helpers' do
8
8
 
9
9
  scenario 'invoking action_view helper methods' do
10
10
  visit "/authors/#{@rhg.author.id}/books/#{@rhg.id}"
11
- puts "page: #{page.html}"
12
11
  within 'a' do
13
12
  page.should have_content 'RHG'
14
13
  end
@@ -19,7 +19,6 @@ feature 'decorating controller ivar' do
19
19
  visit '/authors'
20
20
  page.should have_content 'takahashim'
21
21
  page.should have_content 'takahashim'.reverse
22
- page.should have_selector 'a[title="takahashim"]'
23
22
  end
24
23
 
25
24
  scenario "decorating models' array in ivar" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r_decorator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,6 +36,7 @@ files:
36
36
  - lib/generators/test_unit/templates/decorator_test.rb
37
37
  - lib/r_decorator.rb
38
38
  - lib/r_decorator/base.rb
39
+ - lib/r_decorator/engine.rb
39
40
  - lib/r_decorator/railtie.rb
40
41
  - lib/r_decorator/rspec.rb
41
42
  - lib/r_decorator/version.rb