draper 0.17.0 → 0.18.0
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.
- data/CHANGELOG.markdown +6 -0
- data/Readme.markdown +22 -45
- data/draper.gemspec +2 -1
- data/lib/draper.rb +1 -1
- data/lib/draper/base.rb +4 -4
- data/lib/draper/decorated_enumerable_proxy.rb +34 -1
- data/lib/draper/model_support.rb +11 -3
- data/lib/draper/railtie.rb +2 -2
- data/lib/draper/system.rb +10 -2
- data/lib/draper/test/minitest_integration.rb +5 -24
- data/lib/draper/test/rspec_integration.rb +0 -6
- data/lib/draper/version.rb +1 -1
- data/lib/draper/view_context.rb +28 -3
- data/lib/generators/rspec/decorator_generator.rb +1 -1
- data/lib/generators/test_unit/decorator_generator.rb +1 -1
- data/lib/generators/test_unit/templates/decorator_test.rb +0 -3
- data/spec/draper/base_spec.rb +12 -2
- data/spec/draper/decorated_enumerable_proxy_spec.rb +45 -0
- data/spec/generators/decorator/decorator_generator_spec.rb +21 -1
- data/spec/minitest-rails/spec_type_spec.rb +63 -0
- data/spec/spec_helper.rb +23 -5
- data/spec/support/samples/enumerable_proxy.rb +3 -0
- data/spec/support/samples/products_decorator.rb +10 -0
- metadata +32 -40
- data/doc/ApplicationDecorator.html +0 -147
- data/doc/Draper.html +0 -123
- data/doc/Draper/AllHelpers.html +0 -256
- data/doc/Draper/Base.html +0 -1222
- data/doc/Draper/DecoratorGenerator.html +0 -216
- data/doc/Draper/LazyHelpers.html +0 -174
- data/doc/Draper/ModelSupport.html +0 -164
- data/doc/Draper/System.html +0 -179
- data/doc/_index.html +0 -172
- data/doc/class_list.html +0 -47
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -53
- data/doc/css/style.css +0 -320
- data/doc/file_list.html +0 -46
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -172
- data/doc/js/app.js +0 -205
- data/doc/js/full_list.js +0 -150
- data/doc/js/jquery.js +0 -16
- data/doc/method_list.html +0 -174
- data/doc/top-level-namespace.html +0 -103
- data/lib/draper/test/view_context.rb +0 -12
- data/spec/draper/helper_support_spec.rb +0 -18
- data/spec/draper/view_context_spec.rb +0 -30
- data/spec/support/samples/active_model.rb +0 -9
- data/spec/support/samples/application_controller.rb +0 -42
- 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
|
-
— 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> »
|
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,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
|