shoulda_machinist_generator 0.0.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.
Files changed (47) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +17 -0
  3. data/Rakefile +28 -0
  4. data/VERSION +1 -0
  5. data/rails_generators/shoulda_model/USAGE +27 -0
  6. data/rails_generators/shoulda_model/shoulda_model_generator.rb +70 -0
  7. data/rails_generators/shoulda_model/templates/blueprints.rb +24 -0
  8. data/rails_generators/shoulda_model/templates/migration.rb +16 -0
  9. data/rails_generators/shoulda_model/templates/model.rb +2 -0
  10. data/rails_generators/shoulda_model/templates/unit_test.rb +7 -0
  11. data/rails_generators/shoulda_scaffold/USAGE +34 -0
  12. data/rails_generators/shoulda_scaffold/shoulda_scaffold_generator.rb +166 -0
  13. data/rails_generators/shoulda_scaffold/templates/blueprint/ie.css +22 -0
  14. data/rails_generators/shoulda_scaffold/templates/blueprint/print.css +29 -0
  15. data/rails_generators/shoulda_scaffold/templates/blueprint/screen.css +226 -0
  16. data/rails_generators/shoulda_scaffold/templates/controller.rb +72 -0
  17. data/rails_generators/shoulda_scaffold/templates/erb/_form.html.erb +8 -0
  18. data/rails_generators/shoulda_scaffold/templates/erb/edit.html.erb +12 -0
  19. data/rails_generators/shoulda_scaffold/templates/erb/index.html.erb +22 -0
  20. data/rails_generators/shoulda_scaffold/templates/erb/layout.html.erb +22 -0
  21. data/rails_generators/shoulda_scaffold/templates/erb/new.html.erb +8 -0
  22. data/rails_generators/shoulda_scaffold/templates/erb/show.html.erb +12 -0
  23. data/rails_generators/shoulda_scaffold/templates/functional_test/basic.rb +107 -0
  24. data/rails_generators/shoulda_scaffold/templates/helper.rb +2 -0
  25. data/test/fixtures/about_yml_plugins/bad_about_yml/about.yml +1 -0
  26. data/test/fixtures/about_yml_plugins/bad_about_yml/init.rb +1 -0
  27. data/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb +1 -0
  28. data/test/fixtures/eager/zoo.rb +3 -0
  29. data/test/fixtures/eager/zoo/reptile_house.rb +2 -0
  30. data/test/fixtures/environment_with_constant.rb +1 -0
  31. data/test/fixtures/lib/generators/missing_class/missing_class_generator.rb +0 -0
  32. data/test/fixtures/lib/generators/working/working_generator.rb +2 -0
  33. data/test/fixtures/plugins/alternate/a/generators/a_generator/a_generator.rb +4 -0
  34. data/test/fixtures/plugins/default/gemlike/init.rb +1 -0
  35. data/test/fixtures/plugins/default/gemlike/lib/gemlike.rb +2 -0
  36. data/test/fixtures/plugins/default/gemlike/rails/init.rb +7 -0
  37. data/test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb +0 -0
  38. data/test/fixtures/plugins/default/stubby/about.yml +2 -0
  39. data/test/fixtures/plugins/default/stubby/generators/stubby_generator/stubby_generator.rb +4 -0
  40. data/test/fixtures/plugins/default/stubby/init.rb +7 -0
  41. data/test/fixtures/plugins/default/stubby/lib/stubby_mixin.rb +2 -0
  42. data/test/fixtures/tmp/test.log +1 -0
  43. data/test/rails_generators/shoulda_model_generator_test.rb +39 -0
  44. data/test/shoulda_macros/generator_macros.rb +36 -0
  45. data/test/stolen_from_railties.rb +288 -0
  46. data/test/test_helper.rb +41 -0
  47. metadata +120 -0
@@ -0,0 +1,29 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+ Blueprint CSS Framework 0.7.1
4
+ http://blueprintcss.googlecode.com
5
+
6
+ * Copyright (c) 2007-2008. See LICENSE for more info.
7
+ * See README for instructions on how to use Blueprint.
8
+ * For credits and origins, see AUTHORS.
9
+ * This is a compressed file. See the sources in the 'src' directory.
10
+
11
+ ----------------------------------------------------------------------- */
12
+
13
+ /* print.css */
14
+ body {line-height:1.5;font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;color:#000;background:none;font-size:10pt;}
15
+ .container {background:none;}
16
+ hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;}
17
+ hr.space {background:#fff;color:#fff;}
18
+ h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;}
19
+ code {font:.9em "Courier New", Monaco, Courier, monospace;}
20
+ img {float:left;margin:1.5em 1.5em 1.5em 0;}
21
+ a img {border:none;}
22
+ p img.top {margin-top:0;}
23
+ blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
24
+ .small {font-size:.9em;}
25
+ .large {font-size:1.1em;}
26
+ .quiet {color:#999;}
27
+ .hide {display:none;}
28
+ a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
29
+ a:link:after, a:visited:after {content:" (" attr(href) ") ";font-size:90%;}
@@ -0,0 +1,226 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+ Blueprint CSS Framework 0.7.1
4
+ http://blueprintcss.googlecode.com
5
+
6
+ * Copyright (c) 2007-2008. See LICENSE for more info.
7
+ * See README for instructions on how to use Blueprint.
8
+ * For credits and origins, see AUTHORS.
9
+ * This is a compressed file. See the sources in the 'src' directory.
10
+
11
+ ----------------------------------------------------------------------- */
12
+
13
+ /* reset.css */
14
+ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
15
+ body {line-height:1.5;}
16
+ table {border-collapse:separate;border-spacing:0;}
17
+ caption, th, td {text-align:left;font-weight:normal;}
18
+ table, td, th {vertical-align:middle;}
19
+ blockquote:before, blockquote:after, q:before, q:after {content:"";}
20
+ blockquote, q {quotes:"" "";}
21
+ a img {border:none;}
22
+
23
+ /* typography.css */
24
+ body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;}
25
+ h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
26
+ h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
27
+ h2 {font-size:2em;margin-bottom:0.75em;}
28
+ h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
29
+ h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;height:1.25em;}
30
+ h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
31
+ h6 {font-size:1em;font-weight:bold;}
32
+ h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
33
+ p {margin:0 0 1.5em;}
34
+ p img {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
35
+ p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
36
+ a:focus, a:hover {color:#000;}
37
+ a {color:#009;text-decoration:underline;}
38
+ blockquote {margin:1.5em;color:#666;font-style:italic;}
39
+ strong {font-weight:bold;}
40
+ em, dfn {font-style:italic;}
41
+ dfn {font-weight:bold;}
42
+ sup, sub {line-height:0;}
43
+ abbr, acronym {border-bottom:1px dotted #666;}
44
+ address {margin:0 0 1.5em;font-style:italic;}
45
+ del {color:#666;}
46
+ pre, code {margin:1.5em 0;white-space:pre;}
47
+ pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
48
+ li ul, li ol {margin:0 1.5em;}
49
+ ul, ol {margin:0 1.5em 1.5em 1.5em;}
50
+ ul {list-style-type:disc;}
51
+ ol {list-style-type:decimal;}
52
+ dl {margin:0 0 1.5em 0;}
53
+ dl dt {font-weight:bold;}
54
+ dd {margin-left:1.5em;}
55
+ table {margin-bottom:1.4em;width:100%;}
56
+ th {font-weight:bold;background:#C3D9FF;}
57
+ th, td {padding:4px 10px 4px 5px;}
58
+ tr.even td {background:#E5ECF9;}
59
+ tfoot {font-style:italic;}
60
+ caption {background:#eee;}
61
+ .small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
62
+ .large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
63
+ .hide {display:none;}
64
+ .quiet {color:#666;}
65
+ .loud {color:#000;}
66
+ .highlight {background:#ff0;}
67
+ .added {background:#060;color:#fff;}
68
+ .removed {background:#900;color:#fff;}
69
+ .first {margin-left:0;padding-left:0;}
70
+ .last {margin-right:0;padding-right:0;}
71
+ .top {margin-top:0;padding-top:0;}
72
+ .bottom {margin-bottom:0;padding-bottom:0;}
73
+
74
+ /* grid.css */
75
+ .container {width:950px;margin:0 auto;}
76
+ .showgrid {background:url(src/grid.png);}
77
+ body {margin:1.5em 0;}
78
+ div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21, div.span-22, div.span-23, div.span-24 {float:left;margin-right:10px;}
79
+ div.last {margin-right:0;}
80
+ .span-1 {width:30px;}
81
+ .span-2 {width:70px;}
82
+ .span-3 {width:110px;}
83
+ .span-4 {width:150px;}
84
+ .span-5 {width:190px;}
85
+ .span-6 {width:230px;}
86
+ .span-7 {width:270px;}
87
+ .span-8 {width:310px;}
88
+ .span-9 {width:350px;}
89
+ .span-10 {width:390px;}
90
+ .span-11 {width:430px;}
91
+ .span-12 {width:470px;}
92
+ .span-13 {width:510px;}
93
+ .span-14 {width:550px;}
94
+ .span-15 {width:590px;}
95
+ .span-16 {width:630px;}
96
+ .span-17 {width:670px;}
97
+ .span-18 {width:710px;}
98
+ .span-19 {width:750px;}
99
+ .span-20 {width:790px;}
100
+ .span-21 {width:830px;}
101
+ .span-22 {width:870px;}
102
+ .span-23 {width:910px;}
103
+ .span-24, div.span-24 {width:950px;margin:0;}
104
+ .append-1 {padding-right:40px;}
105
+ .append-2 {padding-right:80px;}
106
+ .append-3 {padding-right:120px;}
107
+ .append-4 {padding-right:160px;}
108
+ .append-5 {padding-right:200px;}
109
+ .append-6 {padding-right:240px;}
110
+ .append-7 {padding-right:280px;}
111
+ .append-8 {padding-right:320px;}
112
+ .append-9 {padding-right:360px;}
113
+ .append-10 {padding-right:400px;}
114
+ .append-11 {padding-right:440px;}
115
+ .append-12 {padding-right:480px;}
116
+ .append-13 {padding-right:520px;}
117
+ .append-14 {padding-right:560px;}
118
+ .append-15 {padding-right:600px;}
119
+ .append-16 {padding-right:640px;}
120
+ .append-17 {padding-right:680px;}
121
+ .append-18 {padding-right:720px;}
122
+ .append-19 {padding-right:760px;}
123
+ .append-20 {padding-right:800px;}
124
+ .append-21 {padding-right:840px;}
125
+ .append-22 {padding-right:880px;}
126
+ .append-23 {padding-right:920px;}
127
+ .prepend-1 {padding-left:40px;}
128
+ .prepend-2 {padding-left:80px;}
129
+ .prepend-3 {padding-left:120px;}
130
+ .prepend-4 {padding-left:160px;}
131
+ .prepend-5 {padding-left:200px;}
132
+ .prepend-6 {padding-left:240px;}
133
+ .prepend-7 {padding-left:280px;}
134
+ .prepend-8 {padding-left:320px;}
135
+ .prepend-9 {padding-left:360px;}
136
+ .prepend-10 {padding-left:400px;}
137
+ .prepend-11 {padding-left:440px;}
138
+ .prepend-12 {padding-left:480px;}
139
+ .prepend-13 {padding-left:520px;}
140
+ .prepend-14 {padding-left:560px;}
141
+ .prepend-15 {padding-left:600px;}
142
+ .prepend-16 {padding-left:640px;}
143
+ .prepend-17 {padding-left:680px;}
144
+ .prepend-18 {padding-left:720px;}
145
+ .prepend-19 {padding-left:760px;}
146
+ .prepend-20 {padding-left:800px;}
147
+ .prepend-21 {padding-left:840px;}
148
+ .prepend-22 {padding-left:880px;}
149
+ .prepend-23 {padding-left:920px;}
150
+ div.border {padding-right:4px;margin-right:5px;border-right:1px solid #eee;}
151
+ div.colborder {padding-right:24px;margin-right:25px;border-right:1px solid #eee;}
152
+ .pull-1 {margin-left:-40px;}
153
+ .pull-2 {margin-left:-80px;}
154
+ .pull-3 {margin-left:-120px;}
155
+ .pull-4 {margin-left:-160px;}
156
+ .pull-5 {margin-left:-200px;}
157
+ .pull-6 {margin-left:-240px;}
158
+ .pull-7 {margin-left:-280px;}
159
+ .pull-8 {margin-left:-320px;}
160
+ .pull-9 {margin-left:-360px;}
161
+ .pull-10 {margin-left:-400px;}
162
+ .pull-11 {margin-left:-440px;}
163
+ .pull-12 {margin-left:-480px;}
164
+ .pull-13 {margin-left:-520px;}
165
+ .pull-14 {margin-left:-560px;}
166
+ .pull-15 {margin-left:-600px;}
167
+ .pull-16 {margin-left:-640px;}
168
+ .pull-17 {margin-left:-680px;}
169
+ .pull-18 {margin-left:-720px;}
170
+ .pull-19 {margin-left:-760px;}
171
+ .pull-20 {margin-left:-800px;}
172
+ .pull-21 {margin-left:-840px;}
173
+ .pull-22 {margin-left:-880px;}
174
+ .pull-23 {margin-left:-920px;}
175
+ .pull-24 {margin-left:-960px;}
176
+ .pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float:left;position:relative;}
177
+ .push-1 {margin:0 -40px 1.5em 40px;}
178
+ .push-2 {margin:0 -80px 1.5em 80px;}
179
+ .push-3 {margin:0 -120px 1.5em 120px;}
180
+ .push-4 {margin:0 -160px 1.5em 160px;}
181
+ .push-5 {margin:0 -200px 1.5em 200px;}
182
+ .push-6 {margin:0 -240px 1.5em 240px;}
183
+ .push-7 {margin:0 -280px 1.5em 280px;}
184
+ .push-8 {margin:0 -320px 1.5em 320px;}
185
+ .push-9 {margin:0 -360px 1.5em 360px;}
186
+ .push-10 {margin:0 -400px 1.5em 400px;}
187
+ .push-11 {margin:0 -440px 1.5em 440px;}
188
+ .push-12 {margin:0 -480px 1.5em 480px;}
189
+ .push-13 {margin:0 -520px 1.5em 520px;}
190
+ .push-14 {margin:0 -560px 1.5em 560px;}
191
+ .push-15 {margin:0 -600px 1.5em 600px;}
192
+ .push-16 {margin:0 -640px 1.5em 640px;}
193
+ .push-17 {margin:0 -680px 1.5em 680px;}
194
+ .push-18 {margin:0 -720px 1.5em 720px;}
195
+ .push-19 {margin:0 -760px 1.5em 760px;}
196
+ .push-20 {margin:0 -800px 1.5em 800px;}
197
+ .push-21 {margin:0 -840px 1.5em 840px;}
198
+ .push-22 {margin:0 -880px 1.5em 880px;}
199
+ .push-23 {margin:0 -920px 1.5em 920px;}
200
+ .push-24 {margin:0 -960px 1.5em 960px;}
201
+ .push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float:right;position:relative;}
202
+ .box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
203
+ hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
204
+ hr.space {background:#fff;color:#fff;}
205
+ .clearfix:after, .container:after {content:".";display:block;height:0;clear:both;visibility:hidden;}
206
+ .clearfix, .container {display:inline-block;}
207
+ * html .clearfix, * html .container {height:1%;}
208
+ .clearfix, .container {display:block;}
209
+ .clear {clear:both;}
210
+
211
+ /* forms.css */
212
+ label {font-weight:bold;}
213
+ fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
214
+ legend {font-weight:bold;font-size:1.2em;}
215
+ input.text, input.title, textarea, select {margin:0.5em 0;border:1px solid #bbb;}
216
+ input.text:focus, input.title:focus, textarea:focus, select:focus {border:1px solid #666;}
217
+ input.text, input.title {width:300px;padding:5px;}
218
+ input.title {font-size:1.5em;}
219
+ textarea {width:390px;height:250px;padding:5px;}
220
+ .error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
221
+ .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
222
+ .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
223
+ .success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
224
+ .error a {color:#8a1f11;}
225
+ .notice a {color:#514721;}
226
+ .success a {color:#264409;}
@@ -0,0 +1,72 @@
1
+ class <%= controller_class_name %>Controller < ApplicationController
2
+ def index
3
+ @<%= table_name %> = <%= class_name %>.find(:all)
4
+
5
+ respond_to do |format|
6
+ format.html
7
+ format.xml { render :xml => @<%= table_name %> }
8
+ end
9
+ end
10
+
11
+ def show
12
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
13
+
14
+ respond_to do |format|
15
+ format.html
16
+ format.xml { render :xml => @<%= file_name %> }
17
+ end
18
+ end
19
+
20
+ def new
21
+ @<%= file_name %> = <%= class_name %>.new
22
+
23
+ respond_to do |format|
24
+ format.html
25
+ format.xml { render :xml => @<%= file_name %> }
26
+ end
27
+ end
28
+
29
+ def edit
30
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
31
+ end
32
+
33
+ def create
34
+ @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
35
+
36
+ respond_to do |format|
37
+ if @<%= file_name %>.save
38
+ flash[:notice] = '<%= singular_name.humanize %> was successfully created.'
39
+ format.html { redirect_to(@<%= file_name %>) }
40
+ format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
41
+ else
42
+ format.html { render :action => "new" }
43
+ format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
44
+ end
45
+ end
46
+ end
47
+
48
+ def update
49
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
50
+
51
+ respond_to do |format|
52
+ if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
53
+ flash[:notice] = '<%= singular_name.humanize %> was successfully updated.'
54
+ format.html { redirect_to(@<%= file_name %>) }
55
+ format.xml { head :ok }
56
+ else
57
+ format.html { render :action => "edit" }
58
+ format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
59
+ end
60
+ end
61
+ end
62
+
63
+ def destroy
64
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
65
+ @<%= file_name %>.destroy
66
+
67
+ respond_to do |format|
68
+ format.html { redirect_to(<%= table_name %>_url) }
69
+ format.xml { head :ok }
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,8 @@
1
+ <%%= form.error_messages %>
2
+
3
+ <dl>
4
+ <% for attribute in attributes -%>
5
+ <dt><%%= form.label :<%= attribute.name %> %></dt>
6
+ <dd><%%= form.<%= attribute.field_type %> :<%= attribute.name %> %></dd>
7
+ <% end -%>
8
+ </dl>
@@ -0,0 +1,12 @@
1
+ <h1>Editing <%= singular_name.humanize %></h1>
2
+
3
+ <%% form_for(@<%= singular_name %>) do |form| %>
4
+ <%%= render :partial => 'form', :locals => {:form => form} %>
5
+ <p><%%= form.submit 'Update' %></p>
6
+ <%% end %>
7
+
8
+ <p>
9
+ <%%= link_to 'Show', @<%= singular_name %> %>
10
+ |
11
+ <%%= link_to 'Back', <%= plural_name %>_path %>
12
+ </p>
@@ -0,0 +1,22 @@
1
+ <h1> Listing <%= plural_name.humanize %></h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <% for attribute in attributes -%>
6
+ <th><%= attribute.column.human_name %></th>
7
+ <% end -%>
8
+ </tr>
9
+
10
+ <%% for <%= singular_name %> in @<%= plural_name %> %>
11
+ <tr>
12
+ <% for attribute in attributes -%>
13
+ <td><%%= h <%= singular_name %>.<%= attribute.name %> %></td>
14
+ <% end -%>
15
+ <td><%%= link_to 'Show', <%= singular_name %> %></td>
16
+ <td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
17
+ <td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
18
+ </tr>
19
+ <%% end %>
20
+ </table>
21
+
22
+ <p><%%= link_to 'New <%= singular_name.humanize %>', new_<%= singular_name %>_path %></p>
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <title><%%= "#{controller.controller_name}: #{controller.action_name}" %></title>
5
+ <%%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
6
+ <%%= stylesheet_link_tag 'blueprint/print', :media => 'print' %>
7
+ <%%= "<!--[if IE]>#{stylesheet_link_tag 'blueprint/ie', :media => 'screen'}<![endif]-->" %>
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <div id="content" class="column span-24">
12
+ <%% flash.each do |key, value| -%>
13
+ <div class="<%%= key %>">
14
+ <%%= h(value) %>
15
+ </div>
16
+ <%% end %>
17
+
18
+ <%%= yield %>
19
+ </div>
20
+ </div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,8 @@
1
+ <h1>New <%= singular_name.humanize %></h1>
2
+
3
+ <%% form_for(@<%= singular_name %>) do |form| %>
4
+ <%%= render :partial => 'form', :locals => {:form => form} %>
5
+ <p><%%= form.submit 'Create' %></p>
6
+ <%% end %>
7
+
8
+ <p><%%= link_to 'Back', <%= plural_name %>_path %></p>
@@ -0,0 +1,12 @@
1
+ <dl>
2
+ <% for attribute in attributes -%>
3
+ <dt><%= attribute.column.human_name %></dt>
4
+ <dd><%%= h @<%= singular_name %>.<%= attribute.name %> %></dd>
5
+ <% end -%>
6
+ </dl>
7
+
8
+ <p>
9
+ <%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>)%>
10
+ |
11
+ <%%= link_to 'Back', <%= plural_name %>_path %>
12
+ </p>
@@ -0,0 +1,107 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class <%= controller_class_name %>ControllerTest < ActionController::TestCase
4
+
5
+ context "The <%= controller_class_name %>Controller" do
6
+
7
+ setup do
8
+ @<%= file_name %> = <%= class_name %>.make
9
+ end
10
+
11
+ context 'GET to index' do
12
+ setup do
13
+ get :index
14
+ end
15
+ should_respond_with :success
16
+ should_assign_to :<%= table_name %>
17
+ end
18
+
19
+ context 'GET to new' do
20
+ setup do
21
+ get :new
22
+ end
23
+
24
+ should_respond_with :success
25
+ should_render_template :new
26
+ should_assign_to :<%= file_name %>
27
+ end
28
+
29
+ context 'POST to create' do
30
+ context "with valid parameters" do
31
+ setup do
32
+ assert_difference('<%= class_name %>.count') do
33
+ post :create, :<%= file_name %> => { }
34
+ end
35
+ end
36
+
37
+ should_redirect_to("the show page") { <%= file_name %>_path(assigns(:<%= file_name %>))}
38
+ should_assign_to :<%= file_name %>
39
+ end
40
+
41
+ # context "with invalid parameters" do
42
+ # setup do
43
+ # assert_no_difference('<%= class_name %>.count') do
44
+ # post :create, :<%= file_name %> => {}
45
+ # end
46
+ # end
47
+
48
+ # should_respond_with :success
49
+ # should_render_template :new
50
+ # should_assign_to :<%= file_name %>
51
+ # end
52
+ end
53
+
54
+ context 'GET to show' do
55
+ setup do
56
+ get :show, :id => @<%= file_name %>.to_param
57
+ end
58
+ should_respond_with :success
59
+ should_render_template :show
60
+ should_assign_to :<%= file_name %>
61
+ end
62
+
63
+ context 'GET to edit' do
64
+ setup do
65
+ get :edit, :id => @<%= file_name %>.to_param
66
+ end
67
+ should_respond_with :success
68
+ should_render_template :edit
69
+ should_assign_to :<%= file_name %>
70
+ end
71
+
72
+ context 'PUT to update' do
73
+ context "with valid parameters" do
74
+ setup do
75
+ assert_no_difference("<%= class_name %>.count") do
76
+ put :update, :id => @<%= file_name %>.to_param, :<%= file_name %> => {}
77
+ end
78
+ end
79
+
80
+ should_redirect_to("the show page") { <%= file_name %>_path(assigns(:<%= file_name %>))}
81
+ should_assign_to :<%= file_name %>
82
+ end
83
+
84
+ # context "with invalid parameters" do
85
+ # setup do
86
+ # assert_no_difference("<%= class_name %>.count") do
87
+ # put :update, :id => @<%= file_name %>.to_param, :<%= file_name %> => { }
88
+ # end
89
+ # end
90
+
91
+ # should_respond_with :success
92
+ # should_render_template :edit
93
+ # should_assign_to :<%= file_name %>
94
+ # end
95
+ end
96
+
97
+ context 'DELETE to destroy' do
98
+ setup do
99
+ assert_difference('<%= class_name %>.count', -1) do
100
+ delete :destroy, :id => @<%= file_name %>.to_param
101
+ end
102
+ end
103
+
104
+ should_redirect_to '<%= table_name %>_path'
105
+ end
106
+ end
107
+ end