linki-nifty_generators 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/.gitignore +3 -0
  2. data/CHANGELOG +105 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +106 -0
  5. data/Rakefile +21 -0
  6. data/TODO +7 -0
  7. data/VERSION +1 -0
  8. data/lib/nifty_generators.rb +3 -0
  9. data/linki-nifty_generators.gemspec +151 -0
  10. data/rails_generators/nifty_authentication/USAGE +50 -0
  11. data/rails_generators/nifty_authentication/lib/insert_commands.rb +74 -0
  12. data/rails_generators/nifty_authentication/nifty_authentication_generator.rb +128 -0
  13. data/rails_generators/nifty_authentication/templates/authentication.rb +61 -0
  14. data/rails_generators/nifty_authentication/templates/authlogic_session.rb +2 -0
  15. data/rails_generators/nifty_authentication/templates/fixtures.yml +24 -0
  16. data/rails_generators/nifty_authentication/templates/migration.rb +20 -0
  17. data/rails_generators/nifty_authentication/templates/sessions_controller.rb +45 -0
  18. data/rails_generators/nifty_authentication/templates/sessions_helper.rb +2 -0
  19. data/rails_generators/nifty_authentication/templates/tests/rspec/sessions_controller.rb +39 -0
  20. data/rails_generators/nifty_authentication/templates/tests/rspec/user.rb +83 -0
  21. data/rails_generators/nifty_authentication/templates/tests/rspec/users_controller.rb +26 -0
  22. data/rails_generators/nifty_authentication/templates/tests/shoulda/sessions_controller.rb +40 -0
  23. data/rails_generators/nifty_authentication/templates/tests/shoulda/user.rb +85 -0
  24. data/rails_generators/nifty_authentication/templates/tests/shoulda/users_controller.rb +27 -0
  25. data/rails_generators/nifty_authentication/templates/tests/testunit/sessions_controller.rb +36 -0
  26. data/rails_generators/nifty_authentication/templates/tests/testunit/user.rb +88 -0
  27. data/rails_generators/nifty_authentication/templates/tests/testunit/users_controller.rb +23 -0
  28. data/rails_generators/nifty_authentication/templates/user.rb +42 -0
  29. data/rails_generators/nifty_authentication/templates/users_controller.rb +18 -0
  30. data/rails_generators/nifty_authentication/templates/users_helper.rb +2 -0
  31. data/rails_generators/nifty_authentication/templates/views/erb/login.html.erb +30 -0
  32. data/rails_generators/nifty_authentication/templates/views/erb/signup.html.erb +24 -0
  33. data/rails_generators/nifty_authentication/templates/views/haml/login.html.haml +30 -0
  34. data/rails_generators/nifty_authentication/templates/views/haml/signup.html.haml +24 -0
  35. data/rails_generators/nifty_config/USAGE +23 -0
  36. data/rails_generators/nifty_config/nifty_config_generator.rb +32 -0
  37. data/rails_generators/nifty_config/templates/config.yml +8 -0
  38. data/rails_generators/nifty_config/templates/load_config.rb +2 -0
  39. data/rails_generators/nifty_layout/USAGE +25 -0
  40. data/rails_generators/nifty_layout/nifty_layout_generator.rb +44 -0
  41. data/rails_generators/nifty_layout/templates/helper.rb +22 -0
  42. data/rails_generators/nifty_layout/templates/layout.html.erb +22 -0
  43. data/rails_generators/nifty_layout/templates/layout.html.haml +19 -0
  44. data/rails_generators/nifty_layout/templates/stylesheet.css +81 -0
  45. data/rails_generators/nifty_layout/templates/stylesheet.sass +67 -0
  46. data/rails_generators/nifty_scaffold/USAGE +51 -0
  47. data/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb +236 -0
  48. data/rails_generators/nifty_scaffold/templates/actions/create.rb +9 -0
  49. data/rails_generators/nifty_scaffold/templates/actions/destroy.rb +6 -0
  50. data/rails_generators/nifty_scaffold/templates/actions/edit.rb +3 -0
  51. data/rails_generators/nifty_scaffold/templates/actions/index.rb +3 -0
  52. data/rails_generators/nifty_scaffold/templates/actions/new.rb +3 -0
  53. data/rails_generators/nifty_scaffold/templates/actions/show.rb +3 -0
  54. data/rails_generators/nifty_scaffold/templates/actions/update.rb +9 -0
  55. data/rails_generators/nifty_scaffold/templates/controller.rb +3 -0
  56. data/rails_generators/nifty_scaffold/templates/fixtures.yml +9 -0
  57. data/rails_generators/nifty_scaffold/templates/helper.rb +2 -0
  58. data/rails_generators/nifty_scaffold/templates/migration.rb +16 -0
  59. data/rails_generators/nifty_scaffold/templates/model.rb +3 -0
  60. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb +11 -0
  61. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb +6 -0
  62. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb +4 -0
  63. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb +4 -0
  64. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb +4 -0
  65. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb +4 -0
  66. data/rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb +12 -0
  67. data/rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb +8 -0
  68. data/rails_generators/nifty_scaffold/templates/tests/rspec/model.rb +11 -0
  69. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb +13 -0
  70. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
  71. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
  72. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb +6 -0
  73. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb +6 -0
  74. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb +6 -0
  75. data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb +13 -0
  76. data/rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb +5 -0
  77. data/rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb +7 -0
  78. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb +11 -0
  79. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb +6 -0
  80. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb +4 -0
  81. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb +4 -0
  82. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb +4 -0
  83. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb +4 -0
  84. data/rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb +11 -0
  85. data/rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb +5 -0
  86. data/rails_generators/nifty_scaffold/templates/tests/testunit/model.rb +7 -0
  87. data/rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb +10 -0
  88. data/rails_generators/nifty_scaffold/templates/views/erb/_sidebar.html.erb +13 -0
  89. data/rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb +20 -0
  90. data/rails_generators/nifty_scaffold/templates/views/erb/index.html.erb +53 -0
  91. data/rails_generators/nifty_scaffold/templates/views/erb/new.html.erb +19 -0
  92. data/rails_generators/nifty_scaffold/templates/views/erb/show.html.erb +44 -0
  93. data/rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml +10 -0
  94. data/rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml +14 -0
  95. data/rails_generators/nifty_scaffold/templates/views/haml/index.html.haml +25 -0
  96. data/rails_generators/nifty_scaffold/templates/views/haml/new.html.haml +7 -0
  97. data/rails_generators/nifty_scaffold/templates/views/haml/show.html.haml +20 -0
  98. data/script/console +9 -0
  99. data/script/destroy +14 -0
  100. data/script/generate +14 -0
  101. data/tasks/deployment.rake +2 -0
  102. data/test/test_helper.rb +117 -0
  103. data/test/test_nifty_authentication_generator.rb +236 -0
  104. data/test/test_nifty_config_generator.rb +37 -0
  105. data/test/test_nifty_layout_generator.rb +42 -0
  106. data/test/test_nifty_scaffold_generator.rb +534 -0
  107. metadata +167 -0
@@ -0,0 +1,236 @@
1
+ class NiftyScaffoldGenerator < Rails::Generator::Base
2
+ attr_accessor :name, :attributes, :controller_actions
3
+
4
+ def initialize(runtime_args, runtime_options = {})
5
+ super
6
+ usage if @args.empty?
7
+
8
+ @name = @args.first
9
+ @controller_actions = []
10
+ @attributes = []
11
+
12
+ @args[1..-1].each do |arg|
13
+ if arg == '!'
14
+ options[:invert] = true
15
+ elsif arg.include? ':'
16
+ @attributes << Rails::Generator::GeneratedAttribute.new(*arg.split(":"))
17
+ else
18
+ @controller_actions << arg
19
+ @controller_actions << 'create' if arg == 'new'
20
+ @controller_actions << 'update' if arg == 'edit'
21
+ end
22
+ end
23
+
24
+ @controller_actions.uniq!
25
+ @attributes.uniq!
26
+
27
+ if options[:invert] || @controller_actions.empty?
28
+ @controller_actions = all_actions - @controller_actions
29
+ end
30
+
31
+ if @attributes.empty?
32
+ options[:skip_model] = true # default to skipping model if no attributes passed
33
+ if model_exists?
34
+ model_columns_for_attributes.each do |column|
35
+ @attributes << Rails::Generator::GeneratedAttribute.new(column.name.to_s, column.type.to_s)
36
+ end
37
+ else
38
+ @attributes << Rails::Generator::GeneratedAttribute.new('name', 'string')
39
+ end
40
+ end
41
+ end
42
+
43
+ def manifest
44
+ record do |m|
45
+ unless options[:skip_model]
46
+ m.directory "app/models"
47
+ m.template "model.rb", "app/models/#{singular_name}.rb"
48
+ unless options[:skip_migration]
49
+ m.migration_template "migration.rb", "db/migrate", :migration_file_name => "create_#{plural_name}"
50
+ end
51
+
52
+ if rspec?
53
+ m.directory "spec/models"
54
+ m.template "tests/#{test_framework}/model.rb", "spec/models/#{singular_name}_spec.rb"
55
+ m.directory "spec/fixtures"
56
+ m.template "fixtures.yml", "spec/fixtures/#{plural_name}.yml"
57
+ else
58
+ m.directory "test/unit"
59
+ m.template "tests/#{test_framework}/model.rb", "test/unit/#{singular_name}_test.rb"
60
+ m.directory "test/fixtures"
61
+ m.template "fixtures.yml", "test/fixtures/#{plural_name}.yml"
62
+ end
63
+ end
64
+
65
+ unless options[:skip_controller]
66
+ m.directory "app/controllers"
67
+ m.template "controller.rb", "app/controllers/#{plural_name}_controller.rb"
68
+
69
+ m.directory "app/helpers"
70
+ m.template "helper.rb", "app/helpers/#{plural_name}_helper.rb"
71
+
72
+ m.directory "app/views/#{plural_name}"
73
+ controller_actions.each do |action|
74
+ if File.exist? source_path("views/#{view_language}/#{action}.html.#{view_language}")
75
+ m.template "views/#{view_language}/#{action}.html.#{view_language}", "app/views/#{plural_name}/#{action}.html.#{view_language}"
76
+ end
77
+ end
78
+
79
+ if File.exist? source_path("views/#{view_language}/_sidebar.html.#{view_language}")
80
+ m.template "views/#{view_language}/_sidebar.html.#{view_language}", "app/views/#{plural_name}/_sidebar.html.#{view_language}"
81
+ end
82
+
83
+ if form_partial?
84
+ m.template "views/#{view_language}/_form.html.#{view_language}", "app/views/#{plural_name}/_form.html.#{view_language}"
85
+ end
86
+
87
+ m.route_resources plural_name
88
+
89
+ if rspec?
90
+ m.directory "spec/controllers"
91
+ m.template "tests/#{test_framework}/controller.rb", "spec/controllers/#{plural_name}_controller_spec.rb"
92
+ else
93
+ m.directory "test/functional"
94
+ m.template "tests/#{test_framework}/controller.rb", "test/functional/#{plural_name}_controller_test.rb"
95
+ end
96
+ end
97
+ end
98
+ end
99
+
100
+ def form_partial?
101
+ actions? :new, :edit
102
+ end
103
+
104
+ def all_actions
105
+ %w[index show new create edit update destroy]
106
+ end
107
+
108
+ def action?(name)
109
+ controller_actions.include? name.to_s
110
+ end
111
+
112
+ def actions?(*names)
113
+ names.all? { |n| action? n.to_s }
114
+ end
115
+
116
+ def singular_name
117
+ name.underscore
118
+ end
119
+
120
+ def plural_name
121
+ name.underscore.pluralize
122
+ end
123
+
124
+ def class_name
125
+ name.camelize
126
+ end
127
+
128
+ def plural_class_name
129
+ plural_name.camelize
130
+ end
131
+
132
+ def controller_methods(dir_name)
133
+ controller_actions.map do |action|
134
+ read_template("#{dir_name}/#{action}.rb")
135
+ end.join(" \n").strip
136
+ end
137
+
138
+ def render_form
139
+ if form_partial?
140
+ if options[:haml]
141
+ "= render :partial => 'form'"
142
+ else
143
+ "<%= render :partial => 'form' %>"
144
+ end
145
+ else
146
+ read_template("views/#{view_language}/_form.html.#{view_language}")
147
+ end
148
+ end
149
+
150
+ def items_path(suffix = 'path')
151
+ if action? :index
152
+ "#{plural_name}_#{suffix}"
153
+ else
154
+ "root_#{suffix}"
155
+ end
156
+ end
157
+
158
+ def item_path(suffix = 'path')
159
+ if action? :show
160
+ "@#{singular_name}"
161
+ else
162
+ items_path(suffix)
163
+ end
164
+ end
165
+
166
+ def item_path_for_spec(suffix = 'path')
167
+ if action? :show
168
+ "#{singular_name}_#{suffix}(assigns[:#{singular_name}])"
169
+ else
170
+ items_path(suffix)
171
+ end
172
+ end
173
+
174
+ def item_path_for_test(suffix = 'path')
175
+ if action? :show
176
+ "#{singular_name}_#{suffix}(assigns(:#{singular_name}))"
177
+ else
178
+ items_path(suffix)
179
+ end
180
+ end
181
+
182
+ def model_columns_for_attributes
183
+ class_name.constantize.columns.reject do |column|
184
+ column.name.to_s =~ /^(id|created_at|updated_at)$/
185
+ end
186
+ end
187
+
188
+ def rspec?
189
+ test_framework == :rspec
190
+ end
191
+
192
+ protected
193
+
194
+ def view_language
195
+ options[:haml] ? 'haml' : 'erb'
196
+ end
197
+
198
+ def test_framework
199
+ options[:test_framework] ||= default_test_framework
200
+ end
201
+
202
+ def default_test_framework
203
+ File.exist?(destination_path("spec")) ? :rspec : :testunit
204
+ end
205
+
206
+ def add_options!(opt)
207
+ opt.separator ''
208
+ opt.separator 'Options:'
209
+ opt.on("--skip-model", "Don't generate a model or migration file.") { |v| options[:skip_model] = v }
210
+ opt.on("--skip-migration", "Don't generate migration file for model.") { |v| options[:skip_migration] = v }
211
+ opt.on("--skip-timestamps", "Don't add timestamps to migration file.") { |v| options[:skip_timestamps] = v }
212
+ opt.on("--skip-controller", "Don't generate controller, helper, or views.") { |v| options[:skip_controller] = v }
213
+ opt.on("--invert", "Generate all controller actions except these mentioned.") { |v| options[:invert] = v }
214
+ opt.on("--haml", "Generate HAML views instead of ERB.") { |v| options[:haml] = v }
215
+ opt.on("--testunit", "Use test/unit for test files.") { options[:test_framework] = :testunit }
216
+ opt.on("--rspec", "Use RSpec for test files.") { options[:test_framework] = :rspec }
217
+ opt.on("--shoulda", "Use Shoulda for test files.") { options[:test_framework] = :shoulda }
218
+ end
219
+
220
+ # is there a better way to do this? Perhaps with const_defined?
221
+ def model_exists?
222
+ File.exist? destination_path("app/models/#{singular_name}.rb")
223
+ end
224
+
225
+ def read_template(relative_path)
226
+ ERB.new(File.read(source_path(relative_path)), nil, '-').result(binding)
227
+ end
228
+
229
+ def banner
230
+ <<-EOS
231
+ Creates a controller and optional model given the name, actions, and attributes.
232
+
233
+ USAGE: #{$0} #{spec.name} ModelName [controller_actions and model:attributes] [options]
234
+ EOS
235
+ end
236
+ end
@@ -0,0 +1,9 @@
1
+ def create
2
+ @<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
3
+ if @<%= singular_name %>.save
4
+ flash[:notice] = "Successfully created <%= name.underscore.humanize.downcase %>."
5
+ redirect_to <%= item_path('url') %>
6
+ else
7
+ render :action => 'new'
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ def destroy
2
+ @<%= singular_name %> = <%= class_name %>.find(params[:id])
3
+ @<%= singular_name %>.destroy
4
+ flash[:notice] = "Successfully destroyed <%= name.underscore.humanize.downcase %>."
5
+ redirect_to <%= items_path('url') %>
6
+ end
@@ -0,0 +1,3 @@
1
+ def edit
2
+ @<%= singular_name %> = <%= class_name %>.find(params[:id])
3
+ end
@@ -0,0 +1,3 @@
1
+ def index
2
+ @<%= plural_name %> = <%= class_name %>.all
3
+ end
@@ -0,0 +1,3 @@
1
+ def new
2
+ @<%= singular_name %> = <%= class_name %>.new
3
+ end
@@ -0,0 +1,3 @@
1
+ def show
2
+ @<%= singular_name %> = <%= class_name %>.find(params[:id])
3
+ end
@@ -0,0 +1,9 @@
1
+ def update
2
+ @<%= singular_name %> = <%= class_name %>.find(params[:id])
3
+ if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
4
+ flash[:notice] = "Successfully updated <%= name.underscore.humanize.downcase %>."
5
+ redirect_to <%= item_path('url') %>
6
+ else
7
+ render :action => 'edit'
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ class <%= plural_class_name %>Controller < ApplicationController
2
+ <%= controller_methods :actions %>
3
+ end
@@ -0,0 +1,9 @@
1
+ one:
2
+ <%- for attribute in attributes -%>
3
+ <%= attribute.name %>: <%= attribute.default %>
4
+ <%- end -%>
5
+
6
+ two:
7
+ <%- for attribute in attributes -%>
8
+ <%= attribute.name %>: <%= attribute.default %>
9
+ <%- end -%>
@@ -0,0 +1,2 @@
1
+ module <%= plural_class_name %>Helper
2
+ end
@@ -0,0 +1,16 @@
1
+ class Create<%= plural_class_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= plural_name %> do |t|
4
+ <%- for attribute in attributes -%>
5
+ t.<%= attribute.type %> :<%= attribute.name %>
6
+ <%- end -%>
7
+ <%- unless options[:skip_timestamps] -%>
8
+ t.timestamps
9
+ <%- end -%>
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :<%= plural_name %>
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ class <%= class_name %> < ActiveRecord::Base
2
+ attr_accessible <%= attributes.map { |a| ":#{a.name}" }.join(", ") %>
3
+ end
@@ -0,0 +1,11 @@
1
+ it "create action should render new template when model is invalid" do
2
+ ActiveRecord::Errors.any_instance.stubs(:empty?).returns(false)
3
+ post :create
4
+ response.should render_template(:new)
5
+ end
6
+
7
+ it "create action should redirect when model is valid" do
8
+ ActiveRecord::Errors.any_instance.stubs(:empty?).returns(true)
9
+ post :create
10
+ response.should redirect_to(<%= item_path_for_spec('url') %>)
11
+ end
@@ -0,0 +1,6 @@
1
+ it "destroy action should destroy model and redirect to index action" do
2
+ <%= singular_name %> = Factory(:<%= singular_name %>)
3
+ delete :destroy, :id => <%= singular_name %>
4
+ response.should redirect_to(<%= items_path('url') %>)
5
+ <%= class_name %>.exists?(<%= singular_name %>.id).should be_false
6
+ end
@@ -0,0 +1,4 @@
1
+ it "edit action should render edit template" do
2
+ get :edit, :id => Factory(:<%= singular_name %>)
3
+ response.should render_template(:edit)
4
+ end
@@ -0,0 +1,4 @@
1
+ it "index action should render index template" do
2
+ get :index
3
+ response.should render_template(:index)
4
+ end
@@ -0,0 +1,4 @@
1
+ it "new action should render new template" do
2
+ get :new
3
+ response.should render_template(:new)
4
+ end
@@ -0,0 +1,4 @@
1
+ it "show action should render show template" do
2
+ get :show, :id => Factory(:<%= singular_name %>)
3
+ response.should render_template(:show)
4
+ end
@@ -0,0 +1,12 @@
1
+ it "update action should render edit template when model is invalid" do
2
+ <%= singular_name %> = Factory(:<%= singular_name %>)
3
+ ActiveRecord::Errors.any_instance.stubs(:empty?).returns(false)
4
+ put :update, :id => <%= singular_name %>
5
+ response.should render_template(:edit)
6
+ end
7
+
8
+ it "update action should redirect when model is valid" do
9
+ ActiveRecord::Errors.any_instance.stubs(:empty?).returns(true)
10
+ put :update, :id => Factory(:<%= singular_name %>)
11
+ response.should redirect_to(<%= item_path_for_spec('url') %>)
12
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe <%= plural_class_name %>Controller do
4
+ fixtures :all
5
+ integrate_views
6
+
7
+ <%= controller_methods 'tests/rspec/actions' %>
8
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe <%= class_name %> do
4
+ it "should be valid" do
5
+ Factory.build(:<%= singular_name %>).should be_valid
6
+ end
7
+
8
+ it "should require a name" do
9
+ Factory.build(:<%= singular_name %>, :name => '').should_not be_valid
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ context "create action" do
2
+ should "render new template when model is invalid" do
3
+ <%= class_name %>.any_instance.stubs(:valid?).returns(false)
4
+ post :create
5
+ assert_template 'new'
6
+ end
7
+
8
+ should "redirect when model is valid" do
9
+ <%= class_name %>.any_instance.stubs(:valid?).returns(true)
10
+ post :create
11
+ assert_redirected_to <%= item_path_for_test('url') %>
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ context "destroy action" do
2
+ should "destroy model and redirect to index action" do
3
+ <%= singular_name %> = <%= class_name %>.first
4
+ delete :destroy, :id => <%= singular_name %>
5
+ assert_redirected_to <%= items_path('url') %>
6
+ assert !<%= class_name %>.exists?(<%= singular_name %>.id)
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ context "edit action" do
2
+ should "render edit template" do
3
+ get :edit, :id => <%= class_name %>.first
4
+ assert_template 'edit'
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ context "index action" do
2
+ should "render index template" do
3
+ get :index
4
+ assert_template 'index'
5
+ end
6
+ end