Sha256: e57c8af4e8375da9e7f5f0e0d38a2814e602faa2ffcd2a9ada5045ea0ff2f4b1
Contents?: true
Size: 854 Bytes
Versions: 2
Compression:
Stored size: 854 Bytes
Contents
module RSpec module Rails module Controller def create_controller name file = controller_file_name(name) unless File.exist?(file) FileUtils.mkdir_p File.dirname(file) File.open(file, 'w') do |f| f.puts controller_content end end end def controller_content name %Q{class #{name.to_s.camelize}Controller < ActionController::Base end} end def remove_controller name file = controller_file_name(name) FileUtils.rm_f(file) if File.exist?(file) end def remove_controllers *names names.each{|name| remove_controller name } end def controller_file_name name File.join(::Rails.root, "app/controllers/#{name}.rb") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec_for_generators-0.3.1 | lib/rspec_for_generators/rails_helpers/rails_controller.rb |
rspec_for_generators-0.3.0 | lib/rspec_for_generators/rails_helpers/rails_controller.rb |