ryanb-nifty-generators 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. data/CHANGELOG +12 -0
  2. data/Manifest +5 -0
  3. data/README +3 -1
  4. data/TODO +3 -0
  5. data/nifty-generators.gemspec +6 -6
  6. data/rails_generators/nifty_config/USAGE +23 -0
  7. data/rails_generators/nifty_config/nifty_config_generator.rb +32 -0
  8. data/rails_generators/nifty_config/templates/config.yml +8 -0
  9. data/rails_generators/nifty_config/templates/load_config.rb +2 -0
  10. data/rails_generators/nifty_scaffold/USAGE +3 -0
  11. data/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb +8 -8
  12. data/rails_generators/nifty_scaffold/templates/action_specs/create.rb +1 -1
  13. data/rails_generators/nifty_scaffold/templates/action_specs/destroy.rb +1 -1
  14. data/rails_generators/nifty_scaffold/templates/action_specs/update.rb +1 -1
  15. data/rails_generators/nifty_scaffold/templates/action_tests/create.rb +1 -1
  16. data/rails_generators/nifty_scaffold/templates/action_tests/destroy.rb +1 -1
  17. data/rails_generators/nifty_scaffold/templates/action_tests/update.rb +1 -1
  18. data/rails_generators/nifty_scaffold/templates/actions/create.rb +1 -1
  19. data/rails_generators/nifty_scaffold/templates/actions/destroy.rb +1 -1
  20. data/rails_generators/nifty_scaffold/templates/actions/update.rb +1 -1
  21. data/rails_generators/nifty_scaffold/templates/helper.rb +0 -1
  22. data/rails_generators/nifty_scaffold/templates/model.rb +0 -1
  23. data/rails_generators/nifty_scaffold/templates/views/_form.html.erb +1 -0
  24. data/test/test_helper.rb +1 -0
  25. data/test/test_nifty_config_generator.rb +37 -0
  26. data/test/test_nifty_scaffold_generator.rb +8 -8
  27. metadata +9 -3
data/CHANGELOG CHANGED
@@ -1,3 +1,15 @@
1
+ *0.1.3* (June 20th, 2008)
2
+
3
+ * using _url in controllers instead of _path
4
+
5
+ * improving the nifty_config default example YAML file
6
+
7
+ *0.1.2* (May 16th, 2008)
8
+
9
+ * mentioning nifty_layout in nifty_scaffold generator
10
+
11
+ * adding nifty_config generator
12
+
1
13
  *0.1.1* (May 9th, 2008)
2
14
 
3
15
  * adding tests and specs to scaffold generator
data/Manifest CHANGED
@@ -2,6 +2,10 @@ CHANGELOG
2
2
  lib/nifty_generators.rb
3
3
  LICENSE
4
4
  Manifest
5
+ rails_generators/nifty_config/nifty_config_generator.rb
6
+ rails_generators/nifty_config/templates/config.yml
7
+ rails_generators/nifty_config/templates/load_config.rb
8
+ rails_generators/nifty_config/USAGE
5
9
  rails_generators/nifty_layout/nifty_layout_generator.rb
6
10
  rails_generators/nifty_layout/templates/helper.rb
7
11
  rails_generators/nifty_layout/templates/layout.html.erb
@@ -47,6 +51,7 @@ rails_generators/nifty_scaffold/USAGE
47
51
  README
48
52
  tasks/deployment.rake
49
53
  test/test_helper.rb
54
+ test/test_nifty_config_generator.rb
50
55
  test/test_nifty_layout_generator.rb
51
56
  test/test_nifty_scaffold_generator.rb
52
57
  TODO
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = nifty-generator
1
+ = Nifty Generators
2
2
 
3
3
  A collection of useful Rails generator scripts by Ryan Bates.
4
4
 
@@ -24,11 +24,13 @@ using the script/generate or script/destroy command.
24
24
 
25
25
  * nifty_layout: generates generic layout, stylesheet, and helper files.
26
26
  * nifty_scaffold: generates a controller and optional model/migration.
27
+ * nifty_config: generates a config YAML file and loader.
27
28
 
28
29
  Run the command with the --help option to learn more.
29
30
 
30
31
  script/generate nifty_layout --help
31
32
 
33
+
32
34
  == Troubleshooting
33
35
 
34
36
  *I get "undefined method 'title'" error for nifty_scaffold.*
data/TODO CHANGED
@@ -1,3 +1,6 @@
1
1
 
2
2
  Nifty Scaffold Generator
3
3
  - add some validation for attributes/action names
4
+
5
+ Nifty Config Generator
6
+ - make it easier to specify non environment specific configs
@@ -1,20 +1,20 @@
1
1
 
2
- # Gem::Specification for Nifty-generators-0.1.1
2
+ # Gem::Specification for Nifty-generators-0.1.3
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.1"
7
+ s.version = "0.1.3"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Ryan Bates"]
13
- s.date = %q{2008-05-09}
13
+ s.date = %q{2008-06-20}
14
14
  s.description = %q{A collection of useful generator scripts for Rails.}
15
15
  s.email = %q{ryan (at) railscasts (dot) com}
16
16
  s.extra_rdoc_files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "README", "tasks/deployment.rake", "TODO"]
17
- s.files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "Manifest", "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/stylesheet.css", "rails_generators/nifty_layout/USAGE", "rails_generators/nifty_scaffold/nifty_scaffold_generator.rb", "rails_generators/nifty_scaffold/templates/action_specs/create.rb", "rails_generators/nifty_scaffold/templates/action_specs/destroy.rb", "rails_generators/nifty_scaffold/templates/action_specs/edit.rb", "rails_generators/nifty_scaffold/templates/action_specs/index.rb", "rails_generators/nifty_scaffold/templates/action_specs/new.rb", "rails_generators/nifty_scaffold/templates/action_specs/show.rb", "rails_generators/nifty_scaffold/templates/action_specs/update.rb", "rails_generators/nifty_scaffold/templates/action_tests/create.rb", "rails_generators/nifty_scaffold/templates/action_tests/destroy.rb", "rails_generators/nifty_scaffold/templates/action_tests/edit.rb", "rails_generators/nifty_scaffold/templates/action_tests/index.rb", "rails_generators/nifty_scaffold/templates/action_tests/new.rb", "rails_generators/nifty_scaffold/templates/action_tests/show.rb", "rails_generators/nifty_scaffold/templates/action_tests/update.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/controller_spec.rb", "rails_generators/nifty_scaffold/templates/controller_test.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/model_spec.rb", "rails_generators/nifty_scaffold/templates/model_test.rb", "rails_generators/nifty_scaffold/templates/views/_form.html.erb", "rails_generators/nifty_scaffold/templates/views/edit.html.erb", "rails_generators/nifty_scaffold/templates/views/index.html.erb", "rails_generators/nifty_scaffold/templates/views/new.html.erb", "rails_generators/nifty_scaffold/templates/views/show.html.erb", "rails_generators/nifty_scaffold/USAGE", "README", "tasks/deployment.rake", "test/test_helper.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb", "TODO", "nifty-generators.gemspec"]
17
+ 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/stylesheet.css", "rails_generators/nifty_layout/USAGE", "rails_generators/nifty_scaffold/nifty_scaffold_generator.rb", "rails_generators/nifty_scaffold/templates/action_specs/create.rb", "rails_generators/nifty_scaffold/templates/action_specs/destroy.rb", "rails_generators/nifty_scaffold/templates/action_specs/edit.rb", "rails_generators/nifty_scaffold/templates/action_specs/index.rb", "rails_generators/nifty_scaffold/templates/action_specs/new.rb", "rails_generators/nifty_scaffold/templates/action_specs/show.rb", "rails_generators/nifty_scaffold/templates/action_specs/update.rb", "rails_generators/nifty_scaffold/templates/action_tests/create.rb", "rails_generators/nifty_scaffold/templates/action_tests/destroy.rb", "rails_generators/nifty_scaffold/templates/action_tests/edit.rb", "rails_generators/nifty_scaffold/templates/action_tests/index.rb", "rails_generators/nifty_scaffold/templates/action_tests/new.rb", "rails_generators/nifty_scaffold/templates/action_tests/show.rb", "rails_generators/nifty_scaffold/templates/action_tests/update.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/controller_spec.rb", "rails_generators/nifty_scaffold/templates/controller_test.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/model_spec.rb", "rails_generators/nifty_scaffold/templates/model_test.rb", "rails_generators/nifty_scaffold/templates/views/_form.html.erb", "rails_generators/nifty_scaffold/templates/views/edit.html.erb", "rails_generators/nifty_scaffold/templates/views/index.html.erb", "rails_generators/nifty_scaffold/templates/views/new.html.erb", "rails_generators/nifty_scaffold/templates/views/show.html.erb", "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"]
18
18
  s.has_rdoc = true
19
19
  s.homepage = %q{http://github.com/ryanb/nifty-generators}
20
20
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Nifty-generators", "--main", "README"]
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.rubyforge_project = %q{nifty-generators}
23
23
  s.rubygems_version = %q{1.0.0}
24
24
  s.summary = %q{A collection of useful generator scripts for Rails.}
25
- s.test_files = ["test/test_helper.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb"]
25
+ s.test_files = ["test/test_helper.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb"]
26
26
  end
27
27
 
28
28
 
@@ -34,7 +34,7 @@ end
34
34
  # begin
35
35
  # require 'echoe'
36
36
  #
37
- # Echoe.new('nifty-generators', '0.1.1') do |p|
37
+ # Echoe.new('nifty-generators', '0.1.3') do |p|
38
38
  # p.summary = "A collection of useful generator scripts for Rails."
39
39
  # p.description = "A collection of useful generator scripts for Rails."
40
40
  # p.url = "http://github.com/ryanb/nifty-generators"
@@ -0,0 +1,23 @@
1
+ Description:
2
+ The nifty_config generator creates YAML file in your config
3
+ directory and an initializer to load this config. The config has a
4
+ separate section for each environment. This is a great place to put
5
+ any config settings you don't want in your app.
6
+
7
+ The config is loaded into a constant called APP_CONFIG by default,
8
+ this changes depending on the name you choose to pass the generator.
9
+ Use this constant to access the config settings like this.
10
+
11
+ APP_CONFIG[:some_setting]
12
+
13
+
14
+ Examples:
15
+ script/generate nifty_config
16
+
17
+ Config: config/app_config.yml
18
+ Initializer: config/initializers/load_app_config.rb
19
+
20
+ script/generate nifty_config passwords
21
+
22
+ Config: config/passwords_config.yml
23
+ Initializer: config/initializers/load_passwords_config.rb
@@ -0,0 +1,32 @@
1
+ class NiftyConfigGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ super
4
+ @name = @args.first || 'app'
5
+ end
6
+
7
+ def manifest
8
+ record do |m|
9
+ m.directory 'config/initializers'
10
+
11
+ m.template "load_config.rb", "config/initializers/load_#{file_name}_config.rb"
12
+ m.file "config.yml", "config/#{file_name}_config.yml"
13
+ end
14
+ end
15
+
16
+ def file_name
17
+ @name.underscore
18
+ end
19
+
20
+ def constant_name
21
+ @name.underscore.upcase
22
+ end
23
+
24
+ protected
25
+ def banner
26
+ <<-EOS
27
+ Creates config and loader files.
28
+
29
+ USAGE: #{$0} #{spec.name} [config_name]
30
+ EOS
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ development:
2
+ domain: localhost:3000
3
+
4
+ test:
5
+ domain: test.host
6
+
7
+ production:
8
+ domain: example.com
@@ -0,0 +1,2 @@
1
+ raw_config = File.read(RAILS_ROOT + "/config/<%= file_name %>_config.yml")
2
+ <%= constant_name %>_CONFIG = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
@@ -3,6 +3,9 @@ Description:
3
3
  views. The resource is ready to use as a starting point for your restful,
4
4
  resource-oriented application. Tests or specs are also generated depending
5
5
  on if you have a "spec" directory or not.
6
+
7
+ IMPORTANT: This generator uses the "title" helper method which is generated
8
+ by the nifty_layout generator. You may want to run that generator first.
6
9
 
7
10
  Usage:
8
11
  Pass the name of the model, either CamelCased or under_scored, as the first
@@ -140,27 +140,27 @@ class NiftyScaffoldGenerator < Rails::Generator::Base
140
140
  end
141
141
  end
142
142
 
143
- def item_path
143
+ def item_path(suffix = 'path')
144
144
  if action? :show
145
145
  "@#{singular_name}"
146
146
  else
147
- "#{plural_name}_path"
147
+ "#{plural_name}_#{suffix}"
148
148
  end
149
149
  end
150
150
 
151
- def item_path_for_spec
151
+ def item_path_for_spec(suffix = 'path')
152
152
  if action? :show
153
- "#{singular_name}_path(assigns[:#{singular_name}])"
153
+ "#{singular_name}_#{suffix}(assigns[:#{singular_name}])"
154
154
  else
155
- "#{plural_name}_path"
155
+ "#{plural_name}_#{suffix}"
156
156
  end
157
157
  end
158
158
 
159
- def item_path_for_test
159
+ def item_path_for_test(suffix = 'path')
160
160
  if action? :show
161
- "#{singular_name}_path(assigns(:#{singular_name}))"
161
+ "#{singular_name}_#{suffix}(assigns(:#{singular_name}))"
162
162
  else
163
- "#{plural_name}_path"
163
+ "#{plural_name}_#{suffix}"
164
164
  end
165
165
  end
166
166
 
@@ -7,5 +7,5 @@
7
7
  it "create action should redirect to index action when model is valid" do
8
8
  <%= class_name %>.any_instance.stubs(:valid?).returns(true)
9
9
  post :create
10
- response.should redirect_to(<%= item_path_for_spec %>)
10
+ response.should redirect_to(<%= item_path_for_spec('url') %>)
11
11
  end
@@ -1,6 +1,6 @@
1
1
  it "destroy action should destroy model and redirect to index action" do
2
2
  <%= singular_name %> = <%= class_name %>.first
3
3
  delete :destroy, :id => <%= singular_name %>
4
- response.should redirect_to(<%= plural_name %>_path)
4
+ response.should redirect_to(<%= plural_name %>_url)
5
5
  <%= class_name %>.exists?(<%= singular_name %>.id).should be_false
6
6
  end
@@ -7,5 +7,5 @@
7
7
  it "update action should redirect to show action when model is valid" do
8
8
  <%= class_name %>.any_instance.stubs(:valid?).returns(true)
9
9
  put :update, :id => <%= class_name %>.first
10
- response.should redirect_to(<%= item_path_for_spec %>)
10
+ response.should redirect_to(<%= item_path_for_spec('url') %>)
11
11
  end
@@ -7,5 +7,5 @@
7
7
  def test_create_valid
8
8
  <%= class_name %>.any_instance.stubs(:valid?).returns(true)
9
9
  post :create
10
- assert_redirected_to <%= item_path_for_test %>
10
+ assert_redirected_to <%= item_path_for_test('url') %>
11
11
  end
@@ -1,6 +1,6 @@
1
1
  def test_destroy
2
2
  <%= singular_name %> = <%= class_name %>.first
3
3
  delete :destroy, :id => <%= singular_name %>
4
- assert_redirected_to <%= plural_name %>_path
4
+ assert_redirected_to <%= plural_name %>_url
5
5
  assert !<%= class_name %>.exists?(<%= singular_name %>.id)
6
6
  end
@@ -7,5 +7,5 @@
7
7
  def test_update_valid
8
8
  <%= class_name %>.any_instance.stubs(:valid?).returns(true)
9
9
  put :update, :id => <%= class_name %>.first
10
- assert_redirected_to <%= item_path_for_test %>
10
+ assert_redirected_to <%= item_path_for_test('url') %>
11
11
  end
@@ -2,7 +2,7 @@
2
2
  @<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
3
3
  if @<%= singular_name %>.save
4
4
  flash[:notice] = "Successfully created <%= name.humanize.downcase %>."
5
- redirect_to <%= item_path %>
5
+ redirect_to <%= item_path('url') %>
6
6
  else
7
7
  render :action => 'new'
8
8
  end
@@ -2,5 +2,5 @@
2
2
  @<%= singular_name %> = <%= class_name %>.find(params[:id])
3
3
  @<%= singular_name %>.destroy
4
4
  flash[:notice] = "Successfully destroyed <%= name.humanize.downcase %>."
5
- redirect_to <%= plural_name %>_path
5
+ redirect_to <%= plural_name %>_url
6
6
  end
@@ -2,7 +2,7 @@
2
2
  @<%= singular_name %> = <%= class_name %>.find(params[:id])
3
3
  if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
4
4
  flash[:notice] = "Successfully updated <%= name.humanize.downcase %>."
5
- redirect_to <%= item_path %>
5
+ redirect_to <%= item_path('url') %>
6
6
  else
7
7
  render :action => 'edit'
8
8
  end
@@ -1,3 +1,2 @@
1
1
  module <%= plural_class_name %>Helper
2
-
3
2
  end
@@ -1,3 +1,2 @@
1
1
  class <%= class_name %> < ActiveRecord::Base
2
-
3
2
  end
@@ -1,3 +1,4 @@
1
+ <%%= error_messages_for :<%= singular_name %> %>
1
2
  <%% form_for @<%= singular_name %> do |f| %>
2
3
  <%- for attribute in attributes -%>
3
4
  <p>
data/test/test_helper.rb CHANGED
@@ -16,6 +16,7 @@ else
16
16
  end
17
17
 
18
18
  require 'rubygems'
19
+ gem 'rails', '2.0.2' # getting a Rails.configuration error with 2.1
19
20
  require 'rubigen' # gem install rubigen
20
21
  require 'rubigen/helpers/generator_test_helper'
21
22
  require 'rails_generator'
@@ -0,0 +1,37 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper.rb")
2
+
3
+ class TestNiftyLayoutGenerator < Test::Unit::TestCase
4
+ include NiftyGenerators::TestHelper
5
+
6
+ # Some generator-related assertions:
7
+ # assert_generated_file(name, &block) # block passed the file contents
8
+ # assert_directory_exists(name)
9
+ # assert_generated_class(name, &block)
10
+ # assert_generated_module(name, &block)
11
+ # assert_generated_test_for(name, &block)
12
+ # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
13
+ # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
14
+ #
15
+ # Other helper methods are:
16
+ # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
17
+ # bare_setup - place this in setup method to create the APP_ROOT folder for each test
18
+ # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
19
+
20
+ context "generator without name" do
21
+ rails_generator :nifty_config
22
+ should_generate_file 'config/app_config.yml'
23
+ should_generate_file 'config/initializers/load_app_config.rb'
24
+ end
25
+
26
+ context "generator with name" do
27
+ rails_generator :nifty_config, "FooBar"
28
+ should_generate_file 'config/foo_bar_config.yml'
29
+
30
+ should "use the name as a constant in the initializer" do
31
+ assert_generated_file 'config/initializers/load_foo_bar_config.rb' do |body|
32
+ assert_match "config/foo_bar_config.yml", body
33
+ assert_match "FOO_BAR_CONFIG = ", body
34
+ end
35
+ end
36
+ end
37
+ end
@@ -139,7 +139,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
139
139
  assert_match "@line_item = LineItem.new(params[:line_item])", body
140
140
  assert_match "if @line_item.save", body
141
141
  assert_match "flash[:notice] = \"Successfully created line item.\"", body
142
- assert_match "redirect_to line_items_path", body
142
+ assert_match "redirect_to line_items_url", body
143
143
  assert_match "render :action => 'new'", body
144
144
  end
145
145
  end
@@ -164,7 +164,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
164
164
  assert_match "def update", body
165
165
  assert_match "if @line_item.update_attributes(params[:line_item])", body
166
166
  assert_match "flash[:notice] = \"Successfully updated line item.\"", body
167
- assert_match "redirect_to line_items_path", body
167
+ assert_match "redirect_to line_items_url", body
168
168
  assert_match "render :action => 'edit'", body
169
169
  end
170
170
  end
@@ -181,7 +181,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
181
181
  assert_match "@line_item = LineItem.find(params[:id])", body
182
182
  assert_match "@line_item.destroy", body
183
183
  assert_match "flash[:notice] = \"Successfully destroyed line item.\"", body
184
- assert_match "redirect_to line_items_path", body
184
+ assert_match "redirect_to line_items_url", body
185
185
  end
186
186
  end
187
187
  end
@@ -218,7 +218,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
218
218
  should "redirect to line item show page, not index" do
219
219
  assert_generated_file "app/controllers/line_items_controller.rb" do |body|
220
220
  assert_match "redirect_to @line_item", body
221
- assert_no_match(/redirect_to line_items_path/, body)
221
+ assert_no_match(/redirect_to line_items_url/, body)
222
222
  end
223
223
  end
224
224
  end
@@ -394,7 +394,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
394
394
 
395
395
  should "should redirect to index action on successful create" do
396
396
  assert_generated_file "spec/controllers/line_items_controller_spec.rb" do |body|
397
- assert_match "redirect_to(line_items_path)", body
397
+ assert_match "redirect_to(line_items_url)", body
398
398
  end
399
399
  end
400
400
  end
@@ -404,7 +404,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
404
404
 
405
405
  should "should redirect to index action on successful update" do
406
406
  assert_generated_file "spec/controllers/line_items_controller_spec.rb" do |body|
407
- assert_match "redirect_to(line_items_path)", body
407
+ assert_match "redirect_to(line_items_url)", body
408
408
  end
409
409
  end
410
410
  end
@@ -461,7 +461,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
461
461
 
462
462
  should "should redirect to index action on successful create" do
463
463
  assert_generated_file "test/functional/line_items_controller_test.rb" do |body|
464
- assert_match "assert_redirected_to line_items_path", body
464
+ assert_match "assert_redirected_to line_items_url", body
465
465
  end
466
466
  end
467
467
  end
@@ -471,7 +471,7 @@ class TestNiftyScaffoldGenerator < Test::Unit::TestCase
471
471
 
472
472
  should "should redirect to index action on successful update" do
473
473
  assert_generated_file "test/functional/line_items_controller_test.rb" do |body|
474
- assert_match "assert_redirected_to line_items_path", body
474
+ assert_match "assert_redirected_to line_items_url", body
475
475
  end
476
476
  end
477
477
  end
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.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-09 00:00:00 -07:00
12
+ date: 2008-06-20 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -31,6 +31,10 @@ files:
31
31
  - lib/nifty_generators.rb
32
32
  - LICENSE
33
33
  - Manifest
34
+ - rails_generators/nifty_config/nifty_config_generator.rb
35
+ - rails_generators/nifty_config/templates/config.yml
36
+ - rails_generators/nifty_config/templates/load_config.rb
37
+ - rails_generators/nifty_config/USAGE
34
38
  - rails_generators/nifty_layout/nifty_layout_generator.rb
35
39
  - rails_generators/nifty_layout/templates/helper.rb
36
40
  - rails_generators/nifty_layout/templates/layout.html.erb
@@ -76,6 +80,7 @@ files:
76
80
  - README
77
81
  - tasks/deployment.rake
78
82
  - test/test_helper.rb
83
+ - test/test_nifty_config_generator.rb
79
84
  - test/test_nifty_layout_generator.rb
80
85
  - test/test_nifty_scaffold_generator.rb
81
86
  - TODO
@@ -107,11 +112,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
112
  requirements: []
108
113
 
109
114
  rubyforge_project: nifty-generators
110
- rubygems_version: 1.0.1
115
+ rubygems_version: 1.2.0
111
116
  signing_key:
112
117
  specification_version: 2
113
118
  summary: A collection of useful generator scripts for Rails.
114
119
  test_files:
115
120
  - test/test_helper.rb
121
+ - test/test_nifty_config_generator.rb
116
122
  - test/test_nifty_layout_generator.rb
117
123
  - test/test_nifty_scaffold_generator.rb