Sha256: dd7ee39e9349618bf01fbc2d68cd855dff0213bf985659b96bc96b3b67f4ec11

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

module RSpec  
  module Rails
    module View
      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  

      def remove_view name
        file = view_file_name(name)
        FileUtils.rm_f(file) if File.exist?(file)
      end

      def remove_views *names
        names.each{|name| remove_view name }
      end      
      
      def view_file_name name
        File.join(::Rails.root, "app/views/#{name}.rb")
      end        
      
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec_for_generators-0.3.1 lib/rspec_for_generators/rails_helpers/rails_view.rb
rspec_for_generators-0.3.0 lib/rspec_for_generators/rails_helpers/rails_view.rb
rspec_for_generators-0.2.1 lib/rspec_for_generators/rails_helpers/rails_view.rb
rspec_for_generators-0.2.0 lib/rspec_for_generators/rails_helpers/rails_view.rb