Module: RSpec::Rails::Helper
- Defined in:
- lib/rspec_for_generators/rails_helpers/rails_helper.rb
Instance Method Summary collapse
- #create_helper(name) ⇒ Object
- #helper_content(name) ⇒ Object
- #remove_helpers(*names) ⇒ Object
- #remove_model(name) ⇒ Object
Instance Method Details
#create_helper(name) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/rspec_for_generators/rails_helpers/rails_helper.rb', line 4 def create_helper name file = helper_file_name(name) unless File.exist?(file) FileUtils.mkdir_p File.dirname(file) File.open(file, 'w') do |f| f.puts helper_content end end end |
#helper_content(name) ⇒ Object
14 15 16 17 |
# File 'lib/rspec_for_generators/rails_helpers/rails_helper.rb', line 14 def helper_content name %Q{class #{name.to_s.camelize}Helper end} end |
#remove_helpers(*names) ⇒ Object
24 25 26 |
# File 'lib/rspec_for_generators/rails_helpers/rails_helper.rb', line 24 def remove_helpers *names names.each{|name| remove_helper name } end |
#remove_model(name) ⇒ Object
19 20 21 22 |
# File 'lib/rspec_for_generators/rails_helpers/rails_helper.rb', line 19 def remove_model name file = helper_file_name(name) FileUtils.rm_f(file) if File.exist?(file) end |