File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ describe "Array Plot Example" do
2
+ let ( :file_path ) { 'spec/tmp/array_plot.eps' }
3
+ let ( :fixture_path ) { 'spec/fixtures/plots/array_plot.eps' }
4
+
5
+ let ( :file_content ) { File . read ( file_path ) }
6
+ let ( :fixture_content ) { File . read ( fixture_path ) }
7
+
8
+ before do
9
+ path = file_path
10
+
11
+ Gnuplot . open do |gp |
12
+ Gnuplot ::Plot . new ( gp ) do |plot |
13
+
14
+ plot . title "Array Plot Example"
15
+ plot . ylabel "x"
16
+ plot . xlabel "x^2"
17
+ plot . set "term" , "postscript eps"
18
+ plot . set "out" , "'#{ path } '"
19
+
20
+ x = ( 0 ..50 ) . collect { |v | v . to_f }
21
+ y = x . collect { |v | v ** 2 }
22
+
23
+ plot . data << Gnuplot ::DataSet . new ( [ x , y ] ) do |ds |
24
+ ds . with = "linespoints"
25
+ ds . notitle
26
+ end
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ after do
33
+ File . delete ( file_path )
34
+ end
35
+
36
+ it do
37
+ expect ( file_content ) . to eq ( fixture_content )
38
+ end
39
+ end
Original file line number Diff line number Diff line change 13
13
# it.
14
14
#
15
15
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ require "gnuplot"
17
+
16
18
RSpec . configure do |config |
17
19
# rspec-expectations config goes here. You can use an alternate
18
20
# assertion/expectation library such as wrong or the stdlib/minitest
You can’t perform that action at this time.
0 commit comments