draper 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGELOG.markdown +6 -0
  2. data/Readme.markdown +22 -45
  3. data/draper.gemspec +2 -1
  4. data/lib/draper.rb +1 -1
  5. data/lib/draper/base.rb +4 -4
  6. data/lib/draper/decorated_enumerable_proxy.rb +34 -1
  7. data/lib/draper/model_support.rb +11 -3
  8. data/lib/draper/railtie.rb +2 -2
  9. data/lib/draper/system.rb +10 -2
  10. data/lib/draper/test/minitest_integration.rb +5 -24
  11. data/lib/draper/test/rspec_integration.rb +0 -6
  12. data/lib/draper/version.rb +1 -1
  13. data/lib/draper/view_context.rb +28 -3
  14. data/lib/generators/rspec/decorator_generator.rb +1 -1
  15. data/lib/generators/test_unit/decorator_generator.rb +1 -1
  16. data/lib/generators/test_unit/templates/decorator_test.rb +0 -3
  17. data/spec/draper/base_spec.rb +12 -2
  18. data/spec/draper/decorated_enumerable_proxy_spec.rb +45 -0
  19. data/spec/generators/decorator/decorator_generator_spec.rb +21 -1
  20. data/spec/minitest-rails/spec_type_spec.rb +63 -0
  21. data/spec/spec_helper.rb +23 -5
  22. data/spec/support/samples/enumerable_proxy.rb +3 -0
  23. data/spec/support/samples/products_decorator.rb +10 -0
  24. metadata +32 -40
  25. data/doc/ApplicationDecorator.html +0 -147
  26. data/doc/Draper.html +0 -123
  27. data/doc/Draper/AllHelpers.html +0 -256
  28. data/doc/Draper/Base.html +0 -1222
  29. data/doc/Draper/DecoratorGenerator.html +0 -216
  30. data/doc/Draper/LazyHelpers.html +0 -174
  31. data/doc/Draper/ModelSupport.html +0 -164
  32. data/doc/Draper/System.html +0 -179
  33. data/doc/_index.html +0 -172
  34. data/doc/class_list.html +0 -47
  35. data/doc/css/common.css +0 -1
  36. data/doc/css/full_list.css +0 -53
  37. data/doc/css/style.css +0 -320
  38. data/doc/file_list.html +0 -46
  39. data/doc/frames.html +0 -13
  40. data/doc/index.html +0 -172
  41. data/doc/js/app.js +0 -205
  42. data/doc/js/full_list.js +0 -150
  43. data/doc/js/jquery.js +0 -16
  44. data/doc/method_list.html +0 -174
  45. data/doc/top-level-namespace.html +0 -103
  46. data/lib/draper/test/view_context.rb +0 -12
  47. data/spec/draper/helper_support_spec.rb +0 -18
  48. data/spec/draper/view_context_spec.rb +0 -30
  49. data/spec/support/samples/active_model.rb +0 -9
  50. data/spec/support/samples/application_controller.rb +0 -42
  51. data/spec/support/samples/application_helper.rb +0 -8
@@ -1,103 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Top Level Namespace
8
-
9
- &mdash; Documentation by YARD 0.7.2
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- relpath = '';
19
- if (relpath != '') relpath += '/';
20
- </script>
21
-
22
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
23
-
24
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
25
-
26
-
27
- </head>
28
- <body>
29
- <script type="text/javascript" charset="utf-8">
30
- if (window.top.frames.main) document.body.className = 'frames';
31
- </script>
32
-
33
- <div id="header">
34
- <div id="menu">
35
-
36
- <a href="_index.html">Index</a> &raquo;
37
-
38
-
39
- <span class="title">Top Level Namespace</span>
40
-
41
-
42
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
- </div>
44
-
45
- <div id="search">
46
-
47
- <a id="class_list_link" href="#">Class List</a>
48
-
49
- <a id="method_list_link" href="#">Method List</a>
50
-
51
- <a id="file_list_link" href="#">File List</a>
52
-
53
- </div>
54
- <div class="clear"></div>
55
- </div>
56
-
57
- <iframe id="search_frame"></iframe>
58
-
59
- <div id="content"><h1>Top Level Namespace
60
-
61
-
62
-
63
- </h1>
64
-
65
- <dl class="box">
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
- </dl>
75
- <div class="clear"></div>
76
-
77
- <h2>Defined Under Namespace</h2>
78
- <p class="children">
79
-
80
-
81
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Draper.html" title="Draper (module)">Draper</a></span>
82
-
83
-
84
-
85
-
86
- </p>
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
- </div>
95
-
96
- <div id="footer">
97
- Generated on Thu Sep 1 01:13:37 2011 by
98
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
99
- 0.7.2 (ruby-1.8.7).
100
- </div>
101
-
102
- </body>
103
- </html>
@@ -1,12 +0,0 @@
1
- module Draper
2
- module ViewContext
3
- def self.infect!(context)
4
- context.instance_eval do
5
- ApplicationController.new.view_context
6
- Draper::ViewContext.current.controller.request ||= ActionController::TestRequest.new
7
- Draper::ViewContext.current.request ||= Draper::ViewContext.current.controller.request
8
- Draper::ViewContext.current.params ||= {}
9
- end
10
- end
11
- end
12
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Draper::HelperSupport do
4
- let(:product){ Product.new }
5
-
6
- context '#decorate' do
7
- it 'renders a block' do
8
- output = ApplicationController.decorate(product){|p| p.model.object_id }
9
- output.should == product.object_id
10
- end
11
-
12
- it 'uses #capture so Rails only renders the content once' do
13
- ApplicationController.decorate(product){|p| p.model.object_id }
14
- ApplicationController.capture_triggered.should be
15
- end
16
- end
17
-
18
- end
@@ -1,30 +0,0 @@
1
- require 'spec_helper'
2
- require 'draper/test/view_context'
3
-
4
- describe Draper::ViewContext do
5
- before(:each) do
6
- Thread.current[:current_view_context] = nil
7
- end
8
-
9
- let(:app_controller) { ApplicationController }
10
- let(:app_controller_instance) { app_controller.new }
11
-
12
- it "provides a method to create a view context while testing" do
13
- Draper::ViewContext.should respond_to(:infect!)
14
- end
15
-
16
- it "copies the controller's view context to draper" do
17
- ctx = app_controller_instance.view_context
18
- Draper::ViewContext.current.should == ctx
19
- end
20
-
21
- describe "view_context priming" do
22
- let(:app_controller_instance) { double(ApplicationController, :view_context => view_context) }
23
- let(:view_context) { double("ApplicationController#view_context") }
24
-
25
- it "primes the view_context when nil" do
26
- app_controller.should_receive(:new).and_return(app_controller_instance)
27
- Draper::ViewContext.current.should == view_context
28
- end
29
- end
30
- end
@@ -1,9 +0,0 @@
1
- module ActiveModel
2
- module Conversion; end
3
- module Validations; end
4
-
5
- class Errors
6
- def initialize(params = nil)
7
- end
8
- end
9
- end
@@ -1,42 +0,0 @@
1
- require './spec/support/samples/application_helper'
2
-
3
- module ActionController
4
- class AbstractController
5
- def view_context
6
- @view_context ||= ApplicationController
7
- end
8
-
9
- def view_context=(input)
10
- @view_context = input
11
- end
12
- end
13
- class Base < AbstractController
14
- @@before_filters = []
15
- def self.before_filters
16
- @@before_filters
17
- end
18
- def self.before_filter(name)
19
- @@before_filters << name
20
- end
21
- end
22
- end
23
-
24
- class ApplicationController < ActionController::Base
25
- extend ActionView::Helpers
26
- extend ActionView::Helpers::TagHelper
27
- extend ActionView::Helpers::UrlHelper
28
- extend ApplicationHelper
29
-
30
- def self.hello
31
- "Hello!"
32
- end
33
-
34
- def self.capture(&block)
35
- @@capture = true
36
- block.call
37
- end
38
-
39
- def self.capture_triggered
40
- @@capture ||= false
41
- end
42
- end
@@ -1,8 +0,0 @@
1
- require 'active_support/core_ext/string/output_safety.rb'
2
- module ApplicationHelper
3
- include ERB::Util
4
-
5
- def hello_world
6
- "Hello, World!"
7
- end
8
- end