ryanb-nifty-generators 0.1.5 → 0.1.6
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 +6 -0
- data/Manifest +9 -0
- data/TODO +1 -0
- data/nifty-generators.gemspec +11 -18
- data/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb +24 -13
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb +13 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb +6 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb +13 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb +5 -0
- data/rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb +7 -0
- data/test/test_nifty_scaffold_generator.rb +30 -4
- metadata +10 -1
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
*0.1.6* (August 7th, 2008)
|
|
2
|
+
|
|
3
|
+
* adding option to specify Shoulda as testing framework in nifty_scaffold generator
|
|
4
|
+
|
|
5
|
+
* adding options to manually specify rspec or testunit framework in nifty_scaffold generator
|
|
6
|
+
|
|
1
7
|
*0.1.5* (August 7th, 2008)
|
|
2
8
|
|
|
3
9
|
* adding option to nifty layout to generate HAML views and SASS stylesheets
|
data/Manifest
CHANGED
|
@@ -35,6 +35,15 @@ rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb
|
|
|
35
35
|
rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb
|
|
36
36
|
rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb
|
|
37
37
|
rails_generators/nifty_scaffold/templates/tests/rspec/model.rb
|
|
38
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb
|
|
39
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb
|
|
40
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb
|
|
41
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb
|
|
42
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb
|
|
43
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb
|
|
44
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb
|
|
45
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb
|
|
46
|
+
rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb
|
|
38
47
|
rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb
|
|
39
48
|
rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb
|
|
40
49
|
rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb
|
data/TODO
CHANGED
data/nifty-generators.gemspec
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
# Gem::Specification for Nifty-generators-0.1.
|
|
2
|
+
# Gem::Specification for Nifty-generators-0.1.6
|
|
3
3
|
# Originally generated by Echoe
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |s|
|
|
6
6
|
s.name = %q{nifty-generators}
|
|
7
|
-
s.version = "0.1.
|
|
7
|
+
s.version = "0.1.6"
|
|
8
8
|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
10
10
|
s.authors = ["Ryan Bates"]
|
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.description = %q{A collection of useful generator scripts for Rails.}
|
|
13
13
|
s.email = %q{ryan (at) railscasts (dot) com}
|
|
14
14
|
s.extra_rdoc_files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "README", "tasks/deployment.rake", "TODO"]
|
|
15
|
-
s.files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "Manifest", "rails_generators/nifty_config/nifty_config_generator.rb", "rails_generators/nifty_config/templates/config.yml", "rails_generators/nifty_config/templates/load_config.rb", "rails_generators/nifty_config/USAGE", "rails_generators/nifty_layout/nifty_layout_generator.rb", "rails_generators/nifty_layout/templates/helper.rb", "rails_generators/nifty_layout/templates/layout.html.erb", "rails_generators/nifty_layout/templates/layout.html.haml", "rails_generators/nifty_layout/templates/stylesheet.css", "rails_generators/nifty_layout/templates/stylesheet.sass", "rails_generators/nifty_layout/USAGE", "rails_generators/nifty_scaffold/nifty_scaffold_generator.rb", "rails_generators/nifty_scaffold/templates/actions/create.rb", "rails_generators/nifty_scaffold/templates/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/actions/edit.rb", "rails_generators/nifty_scaffold/templates/actions/index.rb", "rails_generators/nifty_scaffold/templates/actions/new.rb", "rails_generators/nifty_scaffold/templates/actions/show.rb", "rails_generators/nifty_scaffold/templates/actions/update.rb", "rails_generators/nifty_scaffold/templates/controller.rb", "rails_generators/nifty_scaffold/templates/fixtures.yml", "rails_generators/nifty_scaffold/templates/helper.rb", "rails_generators/nifty_scaffold/templates/migration.rb", "rails_generators/nifty_scaffold/templates/model.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/model.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/model.rb", "rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/index.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/new.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/show.html.erb", "rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/index.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/new.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/show.html.haml", "rails_generators/nifty_scaffold/USAGE", "README", "tasks/deployment.rake", "test/test_helper.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb", "TODO", "nifty-generators.gemspec"]
|
|
15
|
+
s.files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "Manifest", "rails_generators/nifty_config/nifty_config_generator.rb", "rails_generators/nifty_config/templates/config.yml", "rails_generators/nifty_config/templates/load_config.rb", "rails_generators/nifty_config/USAGE", "rails_generators/nifty_layout/nifty_layout_generator.rb", "rails_generators/nifty_layout/templates/helper.rb", "rails_generators/nifty_layout/templates/layout.html.erb", "rails_generators/nifty_layout/templates/layout.html.haml", "rails_generators/nifty_layout/templates/stylesheet.css", "rails_generators/nifty_layout/templates/stylesheet.sass", "rails_generators/nifty_layout/USAGE", "rails_generators/nifty_scaffold/nifty_scaffold_generator.rb", "rails_generators/nifty_scaffold/templates/actions/create.rb", "rails_generators/nifty_scaffold/templates/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/actions/edit.rb", "rails_generators/nifty_scaffold/templates/actions/index.rb", "rails_generators/nifty_scaffold/templates/actions/new.rb", "rails_generators/nifty_scaffold/templates/actions/show.rb", "rails_generators/nifty_scaffold/templates/actions/update.rb", "rails_generators/nifty_scaffold/templates/controller.rb", "rails_generators/nifty_scaffold/templates/fixtures.yml", "rails_generators/nifty_scaffold/templates/helper.rb", "rails_generators/nifty_scaffold/templates/migration.rb", "rails_generators/nifty_scaffold/templates/model.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/create.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/edit.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/index.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/new.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/show.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb", "rails_generators/nifty_scaffold/templates/tests/rspec/model.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb", "rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/index.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/new.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/show.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/actions/update.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/controller.rb", "rails_generators/nifty_scaffold/templates/tests/testunit/model.rb", "rails_generators/nifty_scaffold/templates/views/erb/_form.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/edit.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/index.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/new.html.erb", "rails_generators/nifty_scaffold/templates/views/erb/show.html.erb", "rails_generators/nifty_scaffold/templates/views/haml/_form.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/edit.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/index.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/new.html.haml", "rails_generators/nifty_scaffold/templates/views/haml/show.html.haml", "rails_generators/nifty_scaffold/USAGE", "README", "tasks/deployment.rake", "test/test_helper.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb", "TODO", "nifty-generators.gemspec"]
|
|
16
16
|
s.has_rdoc = true
|
|
17
17
|
s.homepage = %q{http://github.com/ryanb/nifty-generators}
|
|
18
18
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Nifty-generators", "--main", "README"]
|
|
@@ -38,22 +38,15 @@ end
|
|
|
38
38
|
#
|
|
39
39
|
# require 'rubygems'
|
|
40
40
|
# require 'rake'
|
|
41
|
-
#
|
|
42
|
-
# begin
|
|
43
|
-
# require 'echoe'
|
|
41
|
+
# require 'echoe'
|
|
44
42
|
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
# end
|
|
53
|
-
#
|
|
54
|
-
# rescue LoadError => boom
|
|
55
|
-
# puts "You are missing a dependency required for meta-operations on this gem."
|
|
56
|
-
# puts "#{boom.to_s.capitalize}."
|
|
43
|
+
# Echoe.new('nifty-generators', '0.1.6') do |p|
|
|
44
|
+
# p.summary = "A collection of useful generator scripts for Rails."
|
|
45
|
+
# p.description = "A collection of useful generator scripts for Rails."
|
|
46
|
+
# p.url = "http://github.com/ryanb/nifty-generators"
|
|
47
|
+
# p.author = 'Ryan Bates'
|
|
48
|
+
# p.email = "ryan (at) railscasts (dot) com"
|
|
49
|
+
# p.ignore_pattern = ["script/*", "*.gemspec"]
|
|
57
50
|
# end
|
|
58
51
|
#
|
|
59
52
|
# Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
|
@@ -49,14 +49,14 @@ class NiftyScaffoldGenerator < Rails::Generator::Base
|
|
|
49
49
|
m.migration_template "migration.rb", "db/migrate", :migration_file_name => "create_#{plural_name}"
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
-
if
|
|
52
|
+
if rspec?
|
|
53
53
|
m.directory "spec/models"
|
|
54
|
-
m.template "tests/
|
|
54
|
+
m.template "tests/#{test_framework}/model.rb", "spec/models/#{singular_name}_spec.rb"
|
|
55
55
|
m.directory "spec/fixtures"
|
|
56
56
|
m.template "fixtures.yml", "spec/fixtures/#{plural_name}.yml"
|
|
57
57
|
else
|
|
58
58
|
m.directory "test/unit"
|
|
59
|
-
m.template "tests/
|
|
59
|
+
m.template "tests/#{test_framework}/model.rb", "test/unit/#{singular_name}_test.rb"
|
|
60
60
|
m.directory "test/fixtures"
|
|
61
61
|
m.template "fixtures.yml", "test/fixtures/#{plural_name}.yml"
|
|
62
62
|
end
|
|
@@ -65,10 +65,10 @@ class NiftyScaffoldGenerator < Rails::Generator::Base
|
|
|
65
65
|
unless options[:skip_controller]
|
|
66
66
|
m.directory "app/controllers"
|
|
67
67
|
m.template "controller.rb", "app/controllers/#{plural_name}_controller.rb"
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
m.directory "app/helpers"
|
|
70
70
|
m.template "helper.rb", "app/helpers/#{plural_name}_helper.rb"
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
m.directory "app/views/#{plural_name}"
|
|
73
73
|
controller_actions.each do |action|
|
|
74
74
|
if File.exist? source_path("views/#{view_language}/#{action}.html.#{view_language}")
|
|
@@ -82,12 +82,12 @@ class NiftyScaffoldGenerator < Rails::Generator::Base
|
|
|
82
82
|
|
|
83
83
|
m.route_resources plural_name
|
|
84
84
|
|
|
85
|
-
if
|
|
85
|
+
if rspec?
|
|
86
86
|
m.directory "spec/controllers"
|
|
87
|
-
m.template "tests/
|
|
87
|
+
m.template "tests/#{test_framework}/controller.rb", "spec/controllers/#{plural_name}_controller_spec.rb"
|
|
88
88
|
else
|
|
89
89
|
m.directory "test/functional"
|
|
90
|
-
m.template "tests/
|
|
90
|
+
m.template "tests/#{test_framework}/controller.rb", "test/functional/#{plural_name}_controller_test.rb"
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
93
|
end
|
|
@@ -173,16 +173,24 @@ class NiftyScaffoldGenerator < Rails::Generator::Base
|
|
|
173
173
|
end
|
|
174
174
|
end
|
|
175
175
|
|
|
176
|
-
def
|
|
177
|
-
|
|
176
|
+
def rspec?
|
|
177
|
+
test_framework == :rspec
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
protected
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
def view_language
|
|
183
183
|
options[:haml] ? 'haml' : 'erb'
|
|
184
184
|
end
|
|
185
|
-
|
|
185
|
+
|
|
186
|
+
def test_framework
|
|
187
|
+
options[:test_framework] ||= default_test_framework
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def default_test_framework
|
|
191
|
+
File.exist?(destination_path("spec")) ? :rspec : :testunit
|
|
192
|
+
end
|
|
193
|
+
|
|
186
194
|
def add_options!(opt)
|
|
187
195
|
opt.separator ''
|
|
188
196
|
opt.separator 'Options:'
|
|
@@ -192,8 +200,11 @@ protected
|
|
|
192
200
|
opt.on("--skip-controller", "Don't generate controller, helper, or views.") { |v| options[:skip_controller] = v }
|
|
193
201
|
opt.on("--invert", "Generate all controller actions except these mentioned.") { |v| options[:invert] = v }
|
|
194
202
|
opt.on("--haml", "Generate HAML views instead of ERB.") { |v| options[:haml] = v }
|
|
203
|
+
opt.on("--testunit", "Use test/unit for test files.") { options[:test_framework] = :testunit }
|
|
204
|
+
opt.on("--rspec", "Use RSpec for test files.") { options[:test_framework] = :rspec }
|
|
205
|
+
opt.on("--shoulda", "Use Shoulda for test files.") { options[:test_framework] = :shoulda }
|
|
195
206
|
end
|
|
196
|
-
|
|
207
|
+
|
|
197
208
|
# is there a better way to do this? Perhaps with const_defined?
|
|
198
209
|
def model_exists?
|
|
199
210
|
File.exist? destination_path("app/models/#{singular_name}.rb")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
context "create action"
|
|
2
|
+
should "render new template when model is invalid"
|
|
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"
|
|
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"
|
|
2
|
+
should "destroy model and redirect to index action"
|
|
3
|
+
<%= singular_name %> = <%= class_name %>.first
|
|
4
|
+
delete :destroy, :id => <%= singular_name %>
|
|
5
|
+
assert_redirected_to <%= plural_name %>_url
|
|
6
|
+
assert !<%= class_name %>.exists?(<%= singular_name %>.id)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
context "update action"
|
|
2
|
+
should "render edit template when model is invalid"
|
|
3
|
+
<%= class_name %>.any_instance.stubs(:valid?).returns(false)
|
|
4
|
+
put :update, :id => <%= class_name %>.first
|
|
5
|
+
assert_template 'edit'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
should "redirect when model is valid"
|
|
9
|
+
<%= class_name %>.any_instance.stubs(:valid?).returns(true)
|
|
10
|
+
put :update, :id => <%= class_name %>.first
|
|
11
|
+
assert_redirected_to <%= item_path_for_test('url') %>
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -392,7 +392,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
|
|
|
392
392
|
end
|
|
393
393
|
end
|
|
394
394
|
|
|
395
|
-
should "
|
|
395
|
+
should "redirect to index action on successful create" do
|
|
396
396
|
assert_generated_file "spec/controllers/line_items_controller_spec.rb" do |body|
|
|
397
397
|
assert_match "redirect_to(line_items_url)", body
|
|
398
398
|
end
|
|
@@ -402,12 +402,18 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
|
|
|
402
402
|
context "generator with edit and index actions" do
|
|
403
403
|
rails_generator :nifty_scaffold, "line_item", "edit", "index"
|
|
404
404
|
|
|
405
|
-
should "
|
|
405
|
+
should "redirect to index action on successful update" do
|
|
406
406
|
assert_generated_file "spec/controllers/line_items_controller_spec.rb" do |body|
|
|
407
407
|
assert_match "redirect_to(line_items_url)", body
|
|
408
408
|
end
|
|
409
409
|
end
|
|
410
410
|
end
|
|
411
|
+
|
|
412
|
+
context "generator with testunit specified" do
|
|
413
|
+
rails_generator :nifty_scaffold, "line_item", "name:string", :test_framework => :testunit
|
|
414
|
+
|
|
415
|
+
should_generate_file "test/unit/line_item_test.rb"
|
|
416
|
+
end
|
|
411
417
|
end
|
|
412
418
|
|
|
413
419
|
context "with test dir" do
|
|
@@ -459,7 +465,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
|
|
|
459
465
|
end
|
|
460
466
|
end
|
|
461
467
|
|
|
462
|
-
should "
|
|
468
|
+
should "redirect to index action on successful create" do
|
|
463
469
|
assert_generated_file "test/functional/line_items_controller_test.rb" do |body|
|
|
464
470
|
assert_match "assert_redirected_to line_items_url", body
|
|
465
471
|
end
|
|
@@ -469,12 +475,32 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
|
|
|
469
475
|
context "generator with edit and index actions" do
|
|
470
476
|
rails_generator :nifty_scaffold, "line_item", "edit", "index"
|
|
471
477
|
|
|
472
|
-
should "
|
|
478
|
+
should "redirect to index action on successful update" do
|
|
473
479
|
assert_generated_file "test/functional/line_items_controller_test.rb" do |body|
|
|
474
480
|
assert_match "assert_redirected_to line_items_url", body
|
|
475
481
|
end
|
|
476
482
|
end
|
|
477
483
|
end
|
|
484
|
+
|
|
485
|
+
context "generator with rspec specified" do
|
|
486
|
+
rails_generator :nifty_scaffold, "line_item", "name:string", :test_framework => :rspec
|
|
487
|
+
|
|
488
|
+
should_generate_file "spec/models/line_item_spec.rb"
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
context "generator with shoulda specified" do
|
|
492
|
+
rails_generator :nifty_scaffold, "line_item", "name:string", :test_framework => :shoulda
|
|
493
|
+
|
|
494
|
+
should "have controller and model tests using shoulda syntax" do
|
|
495
|
+
assert_generated_file "test/functional/line_items_controller_test.rb" do |body|
|
|
496
|
+
assert_match " should ", body
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
assert_generated_file "test/unit/line_item_test.rb" do |body|
|
|
500
|
+
assert_match " should ", body
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
end
|
|
478
504
|
end
|
|
479
505
|
|
|
480
506
|
context "generator with haml option" do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ryanb-nifty-generators
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Bates
|
|
@@ -64,6 +64,15 @@ files:
|
|
|
64
64
|
- rails_generators/nifty_scaffold/templates/tests/rspec/actions/update.rb
|
|
65
65
|
- rails_generators/nifty_scaffold/templates/tests/rspec/controller.rb
|
|
66
66
|
- rails_generators/nifty_scaffold/templates/tests/rspec/model.rb
|
|
67
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/actions/create.rb
|
|
68
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/actions/destroy.rb
|
|
69
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/actions/edit.rb
|
|
70
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/actions/index.rb
|
|
71
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/actions/new.rb
|
|
72
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/actions/show.rb
|
|
73
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/actions/update.rb
|
|
74
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/controller.rb
|
|
75
|
+
- rails_generators/nifty_scaffold/templates/tests/shoulda/model.rb
|
|
67
76
|
- rails_generators/nifty_scaffold/templates/tests/testunit/actions/create.rb
|
|
68
77
|
- rails_generators/nifty_scaffold/templates/tests/testunit/actions/destroy.rb
|
|
69
78
|
- rails_generators/nifty_scaffold/templates/tests/testunit/actions/edit.rb
|