Sha256: 615d8045ad43f38b52ff015a535cc586faf2a86259b80915f22aaecfa24a24d0
Contents?: true
Size: 929 Bytes
Versions: 3
Compression:
Stored size: 929 Bytes
Contents
require 'test/unit' unless defined?(Test) require 'vizres/browser' require 'vizres/scm' module Vizres TMP = File.join(RAILS_ROOT, "public", "tmp") RESPONSE_TXT = File.join(TMP, "response.txt") RESPONSE_HTML = File.join(TMP, "response.html") RESPONSE_URI = "http://localhost:3000/tmp/response.html" def vr(format=:web) create_tmp_if_missing if format.is_a?(Symbol) case format when :web then open_from_file(@response.body, RESPONSE_HTML, RESPONSE_URI) when :html then open_from_file(@response.body, RESPONSE_TXT) end else open_from_file(format, RESPONSE_HTML) end end def open_from_file(data, write_to, read_from=nil) File.open(write_to, File::CREAT|File::TRUNC|File::WRONLY) { |f| f << data } Browser.open(read_from || write_to) end def create_tmp_if_missing SCM.create_tmp_if_missing(TMP) end end Test::Unit::TestCase.send(:include, Vizres)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
radiant-0.7.2 | vendor/plugins/vizres/lib/vizres.rb |
radiant-0.7.0 | vendor/plugins/vizres/lib/vizres.rb |
radiant-0.7.1 | vendor/plugins/vizres/lib/vizres.rb |