laszpio-googlecharts 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,451 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+ require File.dirname(__FILE__) + '/../lib/gchart'
3
+
4
+ Chart::Theme.add_theme_file("#{File.dirname(__FILE__)}/fixtures/test_theme.yml")
5
+
6
+ # Time to add your specs!
7
+ # http://rspec.rubyforge.org/
8
+ describe "generating a default Gchart" do
9
+
10
+ before(:each) do
11
+ @chart = Gchart.line
12
+ end
13
+
14
+ it "should include the Google URL" do
15
+ @chart.include?("http://chart.apis.google.com/chart?").should be_true
16
+ end
17
+
18
+ it "should have a default size" do
19
+ @chart.include?('chs=300x200').should be_true
20
+ end
21
+
22
+ it "should be able to have a custom size" do
23
+ Gchart.line(:size => '400x600').include?('chs=400x600').should be_true
24
+ Gchart.line(:width => 400, :height => 600).include?('chs=400x600').should be_true
25
+ end
26
+
27
+ it "should have a type" do
28
+ @chart.include?('cht=lc').should be_true
29
+ end
30
+
31
+ it 'should use theme defaults if theme is set' do
32
+ Gchart.line(:theme=>:test).include?('chco=6886B4,FDD84E').should be_true
33
+ Gchart.line(:theme=>:test).include?(Gchart.jstize('chf=c,s,FFFFFF|bg,s,FFFFFF')).should be_true
34
+ end
35
+
36
+ it "should use the simple encoding by default with auto max value" do
37
+ # 9 is the max value in simple encoding, 26 being our max value the 2nd encoded value should be 9
38
+ Gchart.line(:data => [0, 26]).include?('chd=s:A9').should be_true
39
+ Gchart.line(:data => [0, 26], :max_value => 26).should == Gchart.line(:data => [0, 26])
40
+ end
41
+
42
+ it "should support simple encoding with and without max_value" do
43
+ Gchart.line(:data => [0, 26], :max_value => 26).include?('chd=s:A9').should be_true
44
+ Gchart.line(:data => [0, 26], :max_value => false).include?('chd=s:Aa').should be_true
45
+ end
46
+
47
+ it "should support the extended encoding and encode properly" do
48
+ Gchart.line(:data => [0, 10], :encoding => 'extended', :max_value => false).include?('chd=e:AA').should be_true
49
+ Gchart.line(:encoding => 'extended',
50
+ :max_value => false,
51
+ :data => [[0,25,26,51,52,61,62,63], [64,89,90,115,4084]]
52
+ ).include?('chd=e:AAAZAaAzA0A9A-A.,BABZBaBz.0').should be_true
53
+ end
54
+
55
+ it "should auto set the max value for extended encoding" do
56
+ Gchart.line(:data => [0, 25], :encoding => 'extended', :max_value => false).include?('chd=e:AAAZ').should be_true
57
+ # Extended encoding max value is '..'
58
+ Gchart.line(:data => [0, 25], :encoding => 'extended').include?('chd=e:AA..').should be_true
59
+ end
60
+
61
+ it "should be able to have data with text encoding" do
62
+ Gchart.line(:data => [10, 5.2, 4, 45, 78], :encoding => 'text').include?('chd=t:10,5.2,4,45,78').should be_true
63
+ end
64
+
65
+ it "should be able to have muliple set of data with text encoding" do
66
+ Gchart.line(:data => [[10, 5.2, 4, 45, 78], [20, 40, 70, 15, 99]], :encoding => 'text').include?(Gchart.jstize('chd=t:10,5.2,4,45,78|20,40,70,15,99')).should be_true
67
+ end
68
+
69
+ it "should be able to receive a custom param" do
70
+ Gchart.line(:custom => 'ceci_est_une_pipe').include?('ceci_est_une_pipe').should be_true
71
+ end
72
+
73
+ it "should be able to set label axis" do
74
+ Gchart.line(:axis_with_labels => 'x,y,r').include?('chxt=x,y,r').should be_true
75
+ Gchart.line(:axis_with_labels => ['x','y','r']).include?('chxt=x,y,r').should be_true
76
+ end
77
+
78
+ it "should be able to have axis labels" do
79
+ Gchart.line(:axis_labels => ['Jan|July|Jan|July|Jan', '0|100', 'A|B|C', '2005|2006|2007']).include?(Gchart.jstize('chxl=0:|Jan|July|Jan|July|Jan|1:|0|100|2:|A|B|C|3:|2005|2006|2007')).should be_true
80
+ Gchart.line(:axis_labels => ['Jan|July|Jan|July|Jan']).include?(Gchart.jstize('chxl=0:|Jan|July|Jan|July|Jan')).should be_true
81
+ Gchart.line(:axis_labels => [['Jan','July','Jan','July','Jan']]).include?(Gchart.jstize('chxl=0:|Jan|July|Jan|July|Jan')).should be_true
82
+ Gchart.line(:axis_labels => [['Jan','July','Jan','July','Jan'], ['0','100'], ['A','B','C'], ['2005','2006','2007']]).include?(Gchart.jstize('chxl=0:|Jan|July|Jan|July|Jan|1:|0|100|2:|A|B|C|3:|2005|2006|2007')).should be_true
83
+ end
84
+
85
+ end
86
+
87
+ describe "generating different type of charts" do
88
+
89
+ it "should be able to generate a line chart" do
90
+ Gchart.line.should be_an_instance_of(String)
91
+ Gchart.line.include?('cht=lc').should be_true
92
+ end
93
+
94
+ it "should be able to generate a sparkline chart" do
95
+ Gchart.sparkline.should be_an_instance_of(String)
96
+ Gchart.sparkline.include?('cht=ls').should be_true
97
+ end
98
+
99
+ it "should be able to generate a line xy chart" do
100
+ Gchart.line_xy.should be_an_instance_of(String)
101
+ Gchart.line_xy.include?('cht=lxy').should be_true
102
+ end
103
+
104
+ it "should be able to generate a scatter chart" do
105
+ Gchart.scatter.should be_an_instance_of(String)
106
+ Gchart.scatter.include?('cht=s').should be_true
107
+ end
108
+
109
+ it "should be able to generate a bar chart" do
110
+ Gchart.bar.should be_an_instance_of(String)
111
+ Gchart.bar.include?('cht=bvs').should be_true
112
+ end
113
+
114
+ it "should be able to generate a Venn diagram" do
115
+ Gchart.venn.should be_an_instance_of(String)
116
+ Gchart.venn.include?('cht=v').should be_true
117
+ end
118
+
119
+ it "should be able to generate a Pie Chart" do
120
+ Gchart.pie.should be_an_instance_of(String)
121
+ Gchart.pie.include?('cht=p').should be_true
122
+ end
123
+
124
+ it "should be able to generate a Google-O-Meter" do
125
+ Gchart.meter.should be_an_instance_of(String)
126
+ Gchart.meter.include?('cht=gom').should be_true
127
+ end
128
+
129
+ it "should not support other types" do
130
+ Gchart.sexy.should == "sexy is not a supported chart format, please use one of the following: #{Gchart.supported_types}."
131
+ end
132
+
133
+ end
134
+
135
+ describe "a bar graph" do
136
+
137
+ it "should have a default vertical orientation" do
138
+ Gchart.bar.include?('cht=bvs').should be_true
139
+ end
140
+
141
+ it "should be able to have a different orientation" do
142
+ Gchart.bar(:orientation => 'vertical').include?('cht=bvs').should be_true
143
+ Gchart.bar(:orientation => 'v').include?('cht=bvs').should be_true
144
+ Gchart.bar(:orientation => 'h').include?('cht=bhs').should be_true
145
+ Gchart.bar(:orientation => 'horizontal').include?('cht=bhs').should be_true
146
+ Gchart.bar(:horizontal => false).include?('cht=bvs').should be_true
147
+ end
148
+
149
+ it "should be set to be stacked by default" do
150
+ Gchart.bar.include?('cht=bvs').should be_true
151
+ end
152
+
153
+ it "should be able to stacked or grouped" do
154
+ Gchart.bar(:stacked => true).include?('cht=bvs').should be_true
155
+ Gchart.bar(:stacked => false).include?('cht=bvg').should be_true
156
+ Gchart.bar(:grouped => true).include?('cht=bvg').should be_true
157
+ Gchart.bar(:grouped => false).include?('cht=bvs').should be_true
158
+ end
159
+
160
+ it "should be able to have different bar colors" do
161
+ Gchart.bar(:bar_colors => 'efefef,00ffff').include?('chco=').should be_true
162
+ Gchart.bar(:bar_colors => 'efefef,00ffff').include?('chco=efefef,00ffff').should be_true
163
+ # alias
164
+ Gchart.bar(:bar_color => 'efefef').include?('chco=efefef').should be_true
165
+ end
166
+
167
+ it "should be able to have different bar colors when using an array of colors" do
168
+ Gchart.bar(:bar_colors => ['efefef','00ffff']).include?('chco=efefef,00ffff').should be_true
169
+ end
170
+
171
+ it 'should be able to accept a string of width and spacing options' do
172
+ Gchart.bar(:bar_width_and_spacing => '25,6').include?('chbh=25,6').should be_true
173
+ end
174
+
175
+ it 'should be able to accept a single fixnum width and spacing option to set the bar width' do
176
+ Gchart.bar(:bar_width_and_spacing => 25).include?('chbh=25').should be_true
177
+ end
178
+
179
+ it 'should be able to accept an array of width and spacing options' do
180
+ Gchart.bar(:bar_width_and_spacing => [25,6,12]).include?('chbh=25,6,12').should be_true
181
+ Gchart.bar(:bar_width_and_spacing => [25,6]).include?('chbh=25,6').should be_true
182
+ Gchart.bar(:bar_width_and_spacing => [25]).include?('chbh=25').should be_true
183
+ end
184
+
185
+ describe "with a hash of width and spacing options" do
186
+
187
+ before(:each) do
188
+ @default_width = 23
189
+ @default_spacing = 4
190
+ @default_group_spacing = 8
191
+ end
192
+
193
+ it 'should be able to have a custom bar width' do
194
+ Gchart.bar(:bar_width_and_spacing => {:width => 19}).include?("chbh=19,#{@default_spacing},#{@default_group_spacing}").should be_true
195
+ end
196
+
197
+ it 'should be able to have custom spacing' do
198
+ Gchart.bar(:bar_width_and_spacing => {:spacing => 19}).include?("chbh=#{@default_width},19,#{@default_group_spacing}").should be_true
199
+ end
200
+
201
+ it 'should be able to have custom group spacing' do
202
+ Gchart.bar(:bar_width_and_spacing => {:group_spacing => 19}).include?("chbh=#{@default_width},#{@default_spacing},19").should be_true
203
+ end
204
+
205
+ end
206
+
207
+ end
208
+
209
+ describe "a line chart" do
210
+
211
+ before(:each) do
212
+ @title = 'Chart Title'
213
+ @legend = ['first data set label', 'n data set label']
214
+ @chart = Gchart.line(:title => @title, :legend => @legend)
215
+ end
216
+
217
+ it 'should be able have a chart title' do
218
+ @chart.include?("chtt=Chart+Title").should be_true
219
+ end
220
+
221
+ it "should be able to a custom color and size title" do
222
+ Gchart.line(:title => @title, :title_color => 'FF0000').include?('chts=FF0000').should be_true
223
+ Gchart.line(:title => @title, :title_size => '20').include?('chts=454545,20').should be_true
224
+ end
225
+
226
+ it "should be able to have multiple legends" do
227
+ @chart.include?(Gchart.jstize("chdl=first+data+set+label|n+data+set+label")).should be_true
228
+ end
229
+
230
+ it "should be able to have one legend" do
231
+ chart = Gchart.line(:legend => 'legend label')
232
+ chart.include?("chdl=legend+label").should be_true
233
+ end
234
+
235
+ it "should be able to set the background fill" do
236
+ Gchart.line(:bg => 'efefef').include?("chf=bg,s,efefef").should be_true
237
+ Gchart.line(:bg => {:color => 'efefef', :type => 'solid'}).include?("chf=bg,s,efefef").should be_true
238
+
239
+ Gchart.line(:bg => {:color => 'efefef', :type => 'gradient'}).include?("chf=bg,lg,0,efefef,0,ffffff,1").should be_true
240
+ Gchart.line(:bg => {:color => 'efefef,0,ffffff,1', :type => 'gradient'}).include?("chf=bg,lg,0,efefef,0,ffffff,1").should be_true
241
+ Gchart.line(:bg => {:color => 'efefef', :type => 'gradient', :angle => 90}).include?("chf=bg,lg,90,efefef,0,ffffff,1").should be_true
242
+
243
+ Gchart.line(:bg => {:color => 'efefef', :type => 'stripes'}).include?("chf=bg,ls,90,efefef,0.2,ffffff,0.2").should be_true
244
+ end
245
+
246
+ it "should be able to set a graph fill" do
247
+ Gchart.line(:graph_bg => 'efefef').include?("chf=c,s,efefef").should be_true
248
+ Gchart.line(:graph_bg => {:color => 'efefef', :type => 'solid'}).include?("chf=c,s,efefef").should be_true
249
+ Gchart.line(:graph_bg => {:color => 'efefef', :type => 'gradient'}).include?("chf=c,lg,0,efefef,0,ffffff,1").should be_true
250
+ Gchart.line(:graph_bg => {:color => 'efefef,0,ffffff,1', :type => 'gradient'}).include?("chf=c,lg,0,efefef,0,ffffff,1").should be_true
251
+ Gchart.line(:graph_bg => {:color => 'efefef', :type => 'gradient', :angle => 90}).include?("chf=c,lg,90,efefef,0,ffffff,1").should be_true
252
+ end
253
+
254
+ it "should be able to set both a graph and a background fill" do
255
+ Gchart.line(:bg => 'efefef', :graph_bg => '76A4FB').include?("bg,s,efefef").should be_true
256
+ Gchart.line(:bg => 'efefef', :graph_bg => '76A4FB').include?("c,s,76A4FB").should be_true
257
+ Gchart.line(:bg => 'efefef', :graph_bg => '76A4FB').include?(Gchart.jstize("chf=c,s,76A4FB|bg,s,efefef")).should be_true
258
+ end
259
+
260
+ it "should be able to have different line colors" do
261
+ Gchart.line(:line_colors => 'efefef|00ffff').include?(Gchart.jstize('chco=efefef|00ffff')).should be_true
262
+ Gchart.line(:line_color => 'efefef|00ffff').include?(Gchart.jstize('chco=efefef|00ffff')).should be_true
263
+ end
264
+
265
+ it "should be able to render a graph where all the data values are 0" do
266
+ Gchart.line(:data => [0, 0, 0]).include?("chd=s:AAA").should be_true
267
+ end
268
+
269
+ end
270
+
271
+ describe "a sparkline chart" do
272
+
273
+ before(:each) do
274
+ @title = 'Chart Title'
275
+ @legend = ['first data set label', 'n data set label']
276
+ @jstized_legend = Gchart.jstize(@legend.join('|'))
277
+ @data = [27,25,25,25,25,27,100,31,25,36,25,25,39,25,31,25,25,25,26,26,25,25,28,25,25,100,28,27,31,25,27,27,29,25,27,26,26,25,26,26,35,33,34,25,26,25,36,25,26,37,33,33,37,37,39,25,25,25,25]
278
+ @chart = Gchart.sparkline(:title => @title, :data => @data, :legend => @legend)
279
+ end
280
+
281
+ it "should create a sparkline" do
282
+ @chart.include?('cht=ls').should be_true
283
+ end
284
+
285
+ it 'should be able have a chart title' do
286
+ @chart.include?("chtt=Chart+Title").should be_true
287
+ end
288
+
289
+ it "should be able to a custom color and size title" do
290
+ Gchart.sparkline(:title => @title, :title_color => 'FF0000').include?('chts=FF0000').should be_true
291
+ Gchart.sparkline(:title => @title, :title_size => '20').include?('chts=454545,20').should be_true
292
+ end
293
+
294
+ it "should be able to have multiple legends" do
295
+ @chart.include?(Gchart.jstize("chdl=first+data+set+label|n+data+set+label")).should be_true
296
+ end
297
+
298
+ it "should be able to have one legend" do
299
+ chart = Gchart.sparkline(:legend => 'legend label')
300
+ chart.include?("chdl=legend+label").should be_true
301
+ end
302
+
303
+ it "should be able to set the background fill" do
304
+ Gchart.sparkline(:bg => 'efefef').include?("chf=bg,s,efefef").should be_true
305
+ Gchart.sparkline(:bg => {:color => 'efefef', :type => 'solid'}).include?("chf=bg,s,efefef").should be_true
306
+
307
+ Gchart.sparkline(:bg => {:color => 'efefef', :type => 'gradient'}).include?("chf=bg,lg,0,efefef,0,ffffff,1").should be_true
308
+ Gchart.sparkline(:bg => {:color => 'efefef,0,ffffff,1', :type => 'gradient'}).include?("chf=bg,lg,0,efefef,0,ffffff,1").should be_true
309
+ Gchart.sparkline(:bg => {:color => 'efefef', :type => 'gradient', :angle => 90}).include?("chf=bg,lg,90,efefef,0,ffffff,1").should be_true
310
+
311
+ Gchart.sparkline(:bg => {:color => 'efefef', :type => 'stripes'}).include?("chf=bg,ls,90,efefef,0.2,ffffff,0.2").should be_true
312
+ end
313
+
314
+ it "should be able to set a graph fill" do
315
+ Gchart.sparkline(:graph_bg => 'efefef').include?("chf=c,s,efefef").should be_true
316
+ Gchart.sparkline(:graph_bg => {:color => 'efefef', :type => 'solid'}).include?("chf=c,s,efefef").should be_true
317
+ Gchart.sparkline(:graph_bg => {:color => 'efefef', :type => 'gradient'}).include?("chf=c,lg,0,efefef,0,ffffff,1").should be_true
318
+ Gchart.sparkline(:graph_bg => {:color => 'efefef,0,ffffff,1', :type => 'gradient'}).include?("chf=c,lg,0,efefef,0,ffffff,1").should be_true
319
+ Gchart.sparkline(:graph_bg => {:color => 'efefef', :type => 'gradient', :angle => 90}).include?("chf=c,lg,90,efefef,0,ffffff,1").should be_true
320
+ end
321
+
322
+ it "should be able to set both a graph and a background fill" do
323
+ Gchart.sparkline(:bg => 'efefef', :graph_bg => '76A4FB').include?("bg,s,efefef").should be_true
324
+ Gchart.sparkline(:bg => 'efefef', :graph_bg => '76A4FB').include?("c,s,76A4FB").should be_true
325
+ Gchart.sparkline(:bg => 'efefef', :graph_bg => '76A4FB').include?(Gchart.jstize("chf=c,s,76A4FB|bg,s,efefef")).should be_true
326
+ end
327
+
328
+ it "should be able to have different line colors" do
329
+ Gchart.sparkline(:line_colors => 'efefef|00ffff').include?(Gchart.jstize('chco=efefef|00ffff')).should be_true
330
+ Gchart.sparkline(:line_color => 'efefef|00ffff').include?(Gchart.jstize('chco=efefef|00ffff')).should be_true
331
+ end
332
+
333
+ end
334
+
335
+ describe "a 3d pie chart" do
336
+
337
+ before(:each) do
338
+ @title = 'Chart Title'
339
+ @legend = ['first data set label', 'n data set label']
340
+ @jstized_legend = Gchart.jstize(@legend.join('|'))
341
+ @data = [12,8,40,15,5]
342
+ @chart = Gchart.pie(:title => @title, :legend => @legend, :data => @data)
343
+ end
344
+
345
+ it "should create a pie" do
346
+ @chart.include?('cht=p').should be_true
347
+ end
348
+
349
+ it "should be able to be in 3d" do
350
+ Gchart.pie_3d(:title => @title, :legend => @legend, :data => @data).include?('cht=p3').should be_true
351
+ end
352
+
353
+ it "should be able to set labels by using the legend or labesl accessor" do
354
+ Gchart.pie_3d(:title => @title, :legend => @legend, :data => @data).include?("chl=#{@jstized_legend}").should be_true
355
+ Gchart.pie_3d(:title => @title, :labels => @legend, :data => @data).include?("chl=#{@jstized_legend}").should be_true
356
+ Gchart.pie_3d(:title => @title, :labels => @legend, :data => @data).should == Gchart.pie_3d(:title => @title, :legend => @legend, :data => @data)
357
+ end
358
+
359
+ end
360
+
361
+ describe "a google-o-meter" do
362
+
363
+ before(:each) do
364
+ @data = [70]
365
+ @legend = ['arrow points here']
366
+ @jstized_legend = Gchart.jstize(@legend.join('|'))
367
+ @chart = Gchart.meter(:data => @data)
368
+ end
369
+
370
+ it "should create a meter" do
371
+ @chart.include?('cht=gom').should be_true
372
+ end
373
+
374
+ it "should be able to set a solid background fill" do
375
+ Gchart.meter(:bg => 'efefef').include?("chf=bg,s,efefef").should be_true
376
+ Gchart.meter(:bg => {:color => 'efefef', :type => 'solid'}).include?("chf=bg,s,efefef").should be_true
377
+ end
378
+
379
+ end
380
+
381
+ describe 'exporting a chart' do
382
+
383
+ it "should be available in the url format by default" do
384
+ Gchart.line(:data => [0, 26], :format => 'url').should == Gchart.line(:data => [0, 26])
385
+ end
386
+
387
+ it "should be available as an image tag" do
388
+ Gchart.line(:data => [0, 26], :format => 'image_tag').should match(/<img src=(.*) width="300" height="200" alt="Google Chart" \/>/)
389
+ end
390
+
391
+ it "should be available as an image tag using img_tag alias" do
392
+ Gchart.line(:data => [0, 26], :format => 'img_tag').should match(/<img src=(.*) width="300" height="200" alt="Google Chart" \/>/)
393
+ end
394
+
395
+ it "should be available as an image tag using custom dimensions" do
396
+ Gchart.line(:data => [0, 26], :format => 'image_tag', :size => '400x400').should match(/<img src=(.*) width="400" height="400" alt="Google Chart" \/>/)
397
+ end
398
+
399
+ it "should be available as an image tag using custom alt text" do
400
+ Gchart.line(:data => [0, 26], :format => 'image_tag', :alt => 'Sexy chart').should match(/<img src=(.*) width="300" height="200" alt="Sexy chart" \/>/)
401
+ end
402
+
403
+ it "should be available as an image tag using custom title text" do
404
+ Gchart.line(:data => [0, 26], :format => 'image_tag', :title => 'Sexy chart').should match(/<img src=(.*) width="300" height="200" alt="Google Chart" title="Sexy chart" \/>/)
405
+ end
406
+
407
+ it "should be available as an image tag using custom css id selector" do
408
+ Gchart.line(:data => [0, 26], :format => 'image_tag', :id => 'chart').should match(/<img id="chart" src=(.*) width="300" height="200" alt="Google Chart" \/>/)
409
+ end
410
+
411
+ it "should be available as an image tag using custom css class selector" do
412
+ Gchart.line(:data => [0, 26], :format => 'image_tag', :class => 'chart').should match(/<img class="chart" src=(.*) width="300" height="200" alt="Google Chart" \/>/)
413
+ end
414
+
415
+ it "should use ampersands to separate key/value pairs in URLs by default" do
416
+ Gchart.line(:data => [0, 26]).should satisfy {|chart| chart.include? "&" }
417
+ Gchart.line(:data => [0, 26]).should_not satisfy {|chart| chart.include? "&amp;" }
418
+ end
419
+
420
+ it "should escape ampersands in URLs when used as an image tag" do
421
+ Gchart.line(:data => [0, 26], :format => 'image_tag', :class => 'chart').should satisfy {|chart| chart.include? "&amp;" }
422
+ end
423
+
424
+ it "should be available as a file" do
425
+ File.delete('chart.png') if File.exist?('chart.png')
426
+ Gchart.line(:data => [0, 26], :format => 'file')
427
+ File.exist?('chart.png').should be_true
428
+ File.delete('chart.png') if File.exist?('chart.png')
429
+ end
430
+
431
+ it "should be available as a file using a custom file name" do
432
+ File.delete('custom_file_name.png') if File.exist?('custom_file_name.png')
433
+ Gchart.line(:data => [0, 26], :format => 'file', :filename => 'custom_file_name.png')
434
+ File.exist?('custom_file_name.png').should be_true
435
+ File.delete('custom_file_name.png') if File.exist?('custom_file_name.png')
436
+ end
437
+
438
+ it "should work even with multiple attrs" do
439
+ File.delete('foo.png') if File.exist?('foo.png')
440
+ Gchart.line(:size => '400x200',
441
+ :data => [1,2,3,4,5],
442
+ :axis_labels => [[1,2,3,4, 5], %w[foo bar]],
443
+ :axis_with_labels => 'x,r',
444
+ :format => "file",
445
+ :filename => "foo.png"
446
+ )
447
+ File.exist?('foo.png').should be_true
448
+ File.delete('foo.png') if File.exist?('foo.png')
449
+ end
450
+
451
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour