Skip to content

Commit

Permalink
Merge pull request #13010 from arunagw/cleanedup-generator-test
Browse files Browse the repository at this point in the history
Cleaned up app generator test
  • Loading branch information
senny committed Nov 23, 2013
2 parents 5542dff + 9725bff commit 845b944
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions railties/test/generators/app_generator_test.rb
Expand Up @@ -29,6 +29,7 @@
lib/tasks
lib/assets
log
test/test_helper.rb
test/fixtures
test/controllers
test/models
Expand All @@ -37,6 +38,8 @@
test/integration
vendor
vendor/assets
vendor/assets/stylesheets
vendor/assets/javascripts
tmp/cache
tmp/cache/assets
)
Expand All @@ -58,6 +61,7 @@ def test_assets
assert_file("app/views/layouts/application.html.erb", /stylesheet_link_tag\s+"application", media: "all", "data-turbolinks-track" => true/)
assert_file("app/views/layouts/application.html.erb", /javascript_include_tag\s+"application", "data-turbolinks-track" => true/)
assert_file("app/assets/stylesheets/application.css")
assert_file("app/assets/javascripts/application.js")
end

def test_invalid_application_name_raises_an_error
Expand Down Expand Up @@ -318,33 +322,13 @@ def test_inclusion_of_plateform_dependent_gems
end
end

def test_creation_of_a_test_directory
run_generator
assert_file 'test'
end

def test_creation_of_app_assets_images_directory
run_generator
assert_file "app/assets/images"
end

def test_creation_of_vendor_assets_javascripts_directory
run_generator
assert_file "vendor/assets/javascripts"
end

def test_creation_of_vendor_assets_stylesheets_directory
run_generator
assert_file "vendor/assets/stylesheets"
end

def test_jquery_is_the_default_javascript_library
run_generator
assert_file "app/assets/javascripts/application.js" do |contents|
assert_match %r{^//= require jquery}, contents
assert_match %r{^//= require jquery_ujs}, contents
end
assert_file "Gemfile", /^gem 'jquery-rails'/
assert_gem "jquery-rails"
end

def test_other_javascript_libraries
Expand All @@ -369,6 +353,7 @@ def test_javascript_is_skipped_if_required

assert_file "Gemfile" do |content|
assert_no_match(/coffee-rails/, content)
assert_no_match(/jquery-rails/, content)
end
end

Expand Down

0 comments on commit 845b944

Please sign in to comment.