Last Updated: February 25, 2016
·
946
· fr4nktic

Remove Empty Helpers

find app/helpers -type f | xargs wc -l | grep '^ *2 ' | awk '{print $2}' | xargs rm

2 Responses
Add your response

Tests and fixtures might have been generated along with the empty helpers.

This will be a real handy if you can modify it to remove such common files( e.g. productshelper.rb, spec/helpers/productshelper_spec.rb) too.

over 1 year ago ·

I can't think of a consistant method to check if a helper spec is "empty", especially not by counting lines.

You could configure RSpec, in application.rb, to not create these files:

config.generators do |g|
  g.test_framework :rspec,
    fixtures:         false,
    view_specs:       false,
    helper_specs:     false,
    routing_specs:    false,
    controller_specs: true,
    request_specs:    true
end
over 1 year ago ·