Module: RSpec::Rails::View
- Defined in:
- lib/rspec_for_generators/rails_helpers/rails_view.rb
Instance Method Summary collapse
- #create_view(name, content) ⇒ Object
- #remove_view(name) ⇒ Object
- #remove_views(*names) ⇒ Object
- #view_file_name(name) ⇒ Object
Instance Method Details
#create_view(name, content) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/rspec_for_generators/rails_helpers/rails_view.rb', line 4 def create_view name, content file = view_file_name(name) unless File.exist?(file) FileUtils.mkdir_p File.dirname(file) File.open(file, 'w') do |f| f.puts content end end end |
#remove_view(name) ⇒ Object
14 15 16 17 |
# File 'lib/rspec_for_generators/rails_helpers/rails_view.rb', line 14 def remove_view name file = view_file_name(name) FileUtils.rm_f(file) if File.exist?(file) end |
#remove_views(*names) ⇒ Object
19 20 21 |
# File 'lib/rspec_for_generators/rails_helpers/rails_view.rb', line 19 def remove_views *names names.each{|name| remove_view name } end |