Skip to content

Commit 2b577b1

Browse files
committed
Add simple plot spec proposal
1 parent 1c72ea5 commit 2b577b1

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

spec/lib/ruby_gnuplot/plot_spec.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
describe Gnuplot::Plot do
2+
subject(:plot) { described_class.new }
3+
4+
describe '#to_gplot' do
5+
context 'when nothing has been set' do
6+
it "returns an empty string" do
7+
expect(plot.to_gplot).to eq('')
8+
end
9+
end
10+
11+
context 'when titles and labels have been set' do
12+
let(:expected_string) do
13+
[
14+
'set title "Array Plot Example"',
15+
'set ylabel "x"',
16+
'set xlabel "x^2"',
17+
''
18+
].join("\n")
19+
end
20+
21+
before do
22+
plot.title "Array Plot Example"
23+
plot.ylabel "x"
24+
plot.xlabel "x^2"
25+
end
26+
27+
it "sets title and axis labels" do
28+
expect(plot.to_gplot).to eq(expected_string)
29+
end
30+
end
31+
end
32+
end

0 commit comments

Comments
 (0)