Skip to content

Commit

Permalink
* Fixed writing of JRuby specific output examples
Browse files Browse the repository at this point in the history
  • Loading branch information
donv committed Dec 6, 2012
1 parent 2b643ac commit ca3ccea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions test/gruff_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@
FileUtils.mkdir_p(TEST_OUTPUT_DIR)
FileUtils.rm_f Dir[TEST_OUTPUT_DIR + '/*']

class Gruff::Base
alias :write_org :write

def write(filename="graph.png")
basefilename = File.basename(filename).split('.')[0..-2].join('.')
extension = filename.slice(/\..*$/)
testfilename = File.join(TEST_OUTPUT_DIR, basefilename) + extension
counter = 0
while File.exists? testfilename
counter += 1
testfilename = Fie.join(TEST_OUTPUT_DIR, basefilename) + "-#{counter}#{extension}"
end
write_org(testfilename)
end
end

class GruffTestCase < Test::Unit::TestCase

def setup
Expand Down
2 changes: 1 addition & 1 deletion test/test_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def test_xy_data

def test_xy_data_pairs
g = Gruff::Line.new
g.title = "X/Y Dataset"
g.title = "X/Y Dataset Pairs"
g.dataxy("Apples", [[1,1], [3,2],[4,3],[5,4],[6,4],[10,3]])
g.dataxy("Bapples", [[1,1],[3,1],[4,2],[5,2],[7,3],[9,3]])
g.data("Capples", [1, 1, 2, 2, 3, 3])
Expand Down

0 comments on commit ca3ccea

Please sign in to comment.