mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix generator tests.
This commit is contained in:
parent
9982b5af94
commit
2c54fde54d
1 changed files with 21 additions and 22 deletions
|
@ -8,6 +8,8 @@ DEFAULT_APP_FILES = %w(
|
||||||
Gemfile
|
Gemfile
|
||||||
Rakefile
|
Rakefile
|
||||||
config.ru
|
config.ru
|
||||||
|
app/assets/javascripts
|
||||||
|
app/assets/stylesheets
|
||||||
app/controllers
|
app/controllers
|
||||||
app/helpers
|
app/helpers
|
||||||
app/mailers
|
app/mailers
|
||||||
|
@ -22,8 +24,6 @@ DEFAULT_APP_FILES = %w(
|
||||||
lib/tasks
|
lib/tasks
|
||||||
log
|
log
|
||||||
public/images
|
public/images
|
||||||
public/javascripts
|
|
||||||
public/stylesheets
|
|
||||||
script/rails
|
script/rails
|
||||||
test/fixtures
|
test/fixtures
|
||||||
test/functional
|
test/functional
|
||||||
|
@ -31,11 +31,9 @@ DEFAULT_APP_FILES = %w(
|
||||||
test/performance
|
test/performance
|
||||||
test/unit
|
test/unit
|
||||||
vendor
|
vendor
|
||||||
|
vendor/assets
|
||||||
vendor/plugins
|
vendor/plugins
|
||||||
tmp/sessions
|
|
||||||
tmp/sockets
|
|
||||||
tmp/cache
|
tmp/cache
|
||||||
tmp/pids
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class AppGeneratorTest < Rails::Generators::TestCase
|
class AppGeneratorTest < Rails::Generators::TestCase
|
||||||
|
@ -49,8 +47,9 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
||||||
|
|
||||||
def test_application_controller_and_layout_files
|
def test_application_controller_and_layout_files
|
||||||
run_generator
|
run_generator
|
||||||
assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag :all/
|
assert_file "app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application"/
|
||||||
assert_no_file "public/stylesheets/application.css"
|
assert_file "app/views/layouts/application.html.erb", /javascript_include_tag\s+"application"/
|
||||||
|
assert_file "app/assets/stylesheets/application.css"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_application_name_raises_an_error
|
def test_invalid_application_name_raises_an_error
|
||||||
|
@ -149,37 +148,37 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
||||||
def test_jquery_and_test_unit_are_added_by_default
|
def test_jquery_and_test_unit_are_added_by_default
|
||||||
run_generator
|
run_generator
|
||||||
assert_file "config/application.rb", /#\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(prototype effects dragdrop controls rails\)/
|
assert_file "config/application.rb", /#\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(prototype effects dragdrop controls rails\)/
|
||||||
assert_file "public/javascripts/application.js"
|
assert_file "app/assets/javascripts/application.js"
|
||||||
assert_file "public/javascripts/jquery.js"
|
assert_file "vendor/assets/javascripts/jquery.js"
|
||||||
assert_file "public/javascripts/rails.js"
|
assert_file "vendor/assets/javascripts/jquery_ujs.js"
|
||||||
assert_file "test"
|
assert_file "test"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_javascript_is_skipped_if_required
|
def test_javascript_is_skipped_if_required
|
||||||
run_generator [destination_root, "--skip-javascript"]
|
run_generator [destination_root, "--skip-javascript"]
|
||||||
assert_file "config/application.rb", /^\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(\)/
|
assert_file "config/application.rb", /^\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(\)/
|
||||||
assert_file "public/javascripts/application.js"
|
assert_file "app/assets/javascripts/application.js"
|
||||||
assert_no_file "public/javascripts/jquery.js"
|
assert_no_file "vendor/assets/javascripts/jquery.js"
|
||||||
assert_no_file "public/javascripts/rails.js"
|
assert_no_file "vendor/assets/javascripts/jquery_ujs.js"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_config_prototype_javascript_library
|
def test_config_prototype_javascript_library
|
||||||
run_generator [destination_root, "-j", "prototype"]
|
run_generator [destination_root, "-j", "prototype"]
|
||||||
assert_file "config/application.rb", /^\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(prototype effects dragdrop controls rails\)/
|
assert_file "config/application.rb", /^\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(prototype effects dragdrop controls rails\)/
|
||||||
assert_file "public/javascripts/application.js"
|
assert_file "app/assets/javascripts/application.js"
|
||||||
assert_file "public/javascripts/prototype.js"
|
assert_file "vendor/assets/javascripts/prototype.js"
|
||||||
assert_file "public/javascripts/effects.js"
|
assert_file "vendor/assets/javascripts/effects.js"
|
||||||
assert_file "public/javascripts/dragdrop.js"
|
assert_file "vendor/assets/javascripts/dragdrop.js"
|
||||||
assert_file "public/javascripts/controls.js"
|
assert_file "vendor/assets/javascripts/controls.js"
|
||||||
assert_file "public/javascripts/rails.js", /prototype/
|
assert_file "vendor/assets/javascripts/prototype_ujs.js", /prototype/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_config_jquery_javascript_library
|
def test_config_jquery_javascript_library
|
||||||
run_generator [destination_root, "-j", "jquery"]
|
run_generator [destination_root, "-j", "jquery"]
|
||||||
assert_file "config/application.rb", /#\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(prototype effects dragdrop controls rails\)/
|
assert_file "config/application.rb", /#\s+config\.action_view\.javascript_expansions\[:defaults\]\s+=\s+%w\(prototype effects dragdrop controls rails\)/
|
||||||
assert_file "public/javascripts/application.js"
|
assert_file "app/assets/javascripts/application.js"
|
||||||
assert_file "public/javascripts/jquery.js"
|
assert_file "vendor/assets/javascripts/jquery.js"
|
||||||
assert_file "public/javascripts/rails.js", /jQuery/
|
assert_file "vendor/assets/javascripts/jquery_ujs.js", /jQuery/
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_template_from_dir_pwd
|
def test_template_from_dir_pwd
|
||||||
|
|
Loading…
Reference in a new issue