Sha256: 06196ded1d41c80f69ba9ca3c61759b70bf7f03df79d836c19ce88260ae65155
Contents?: true
Size: 1.57 KB
Versions: 4
Compression:
Stored size: 1.57 KB
Contents
require 'rubygems' require 'spec' $:.unshift(File.dirname(__FILE__) + '/../lib') require 'install_theme' Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each { |matcher| require matcher } # When running specs in TextMate, provide an rputs method to cleanly print objects into HTML display # From http://talklikeaduck.denhaven2.com/2009/09/23/rspec-textmate-pro-tip module Kernel if ENV.keys.find {|env_var| env_var.index("TM_") == 0} require "cgi" def rputs(*args) puts( *["<pre>", args.collect {|a| CGI.escapeHTML(a.to_s)}, "</pre>"]) end else alias_method :rputs, :puts end end def clean_html(orig_file, scope) tmp_dir = ENV['TMPDIR'] || '/tmp' file = File.join(tmp_dir, "#{scope}_clean_html.html") File.open(file, "w") do |f| f << Hpricot(open(orig_file)).to_html end file end def clean_file(orig_file, scope) return clean_html(orig_file, scope) if orig_file =~ /html/ tmp_dir = ENV['TMPDIR'] || '/tmp' file = File.join(tmp_dir, "#{scope}_clean_html.html") File.open(file, "w") do |f| f << File.open(orig_file).readlines.map {|line| line.strip}.join("\n") end file end def setup_base_rails(options = {}) tmp_path = File.dirname(__FILE__) + "/tmp" FileUtils.rm_rf(tmp_path) FileUtils.mkdir_p(tmp_path ) @target_application = File.join(tmp_path, "my_app") FileUtils.cp_r(File.dirname(__FILE__) + "/expected/rails/base_app", @target_application) `haml --rails #{@target_application}` if options[:haml] @target_application end def stdout(&block) stdout_io = StringIO.new yield stdout_io stdout_io.rewind stdout_io.read end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
install_theme-0.7.0 | spec/spec_helper.rb |
install_theme-0.6.2 | spec/spec_helper.rb |
install_theme-0.6.1 | spec/spec_helper.rb |
install_theme-0.6.0 | spec/spec_helper.rb |