mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixes Scaffold generator with --assets=false
Scaffold generator with --assets=false option outputs an error See #9525
This commit is contained in:
parent
903a2c2d33
commit
f1805a6978
3 changed files with 20 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
* Fixes bug with Scaffold generator with --assets=false --resource-route=false See #9525 for more details.
|
||||
|
||||
*Arun Agrawal*
|
||||
|
||||
* Rails::Railtie no longer forces the Rails::Configurable module on everything
|
||||
that subclassess it. Instead, the methods from Rails::Configurable have been
|
||||
moved to class methods in Railtie and the Railtie has been made abstract.
|
||||
|
|
|
@ -8,6 +8,8 @@ module Rails
|
|||
|
||||
class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets"
|
||||
class_option :stylesheet_engine, desc: "Engine for Stylesheets"
|
||||
class_option :assets, :type => :boolean
|
||||
class_option :resource_route, :type => :boolean
|
||||
|
||||
def handle_skip
|
||||
@options = @options.merge(stylesheets: false) unless options[:assets]
|
||||
|
|
|
@ -246,6 +246,20 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
|||
assert_no_file "app/assets/stylesheets/posts.css"
|
||||
end
|
||||
|
||||
def test_scaffold_generator_no_assets
|
||||
run_generator [ "posts", "--assets=false" ]
|
||||
assert_file "app/assets/stylesheets/scaffold.css"
|
||||
assert_no_file "app/assets/javascripts/posts.js"
|
||||
assert_no_file "app/assets/stylesheets/posts.css"
|
||||
end
|
||||
|
||||
def test_scaffold_generator_no_assets
|
||||
run_generator [ "posts", "--resource-route=false" ]
|
||||
assert_file "config/routes.rb" do |route|
|
||||
assert_no_match(/resources :posts$/, route)
|
||||
end
|
||||
end
|
||||
|
||||
def test_scaffold_generator_no_stylesheets
|
||||
run_generator [ "posts", "--no-stylesheets" ]
|
||||
assert_no_file "app/assets/stylesheets/scaffold.css"
|
||||
|
|
Loading…
Reference in a new issue