File tree Expand file tree Collapse file tree 1 file changed +63
-2
lines changed Expand file tree Collapse file tree 1 file changed +63
-2
lines changed Original file line number Diff line number Diff line change 1
- describe Gnuplot ::Plot do
1
+ describe Gnuplot ::Plot :: Style do
2
2
subject ( :style ) { described_class . new }
3
3
4
- xit "Adds tests here"
4
+ let ( :index ) { style . index }
5
+
6
+ describe '#to_s' do
7
+ context "when nothing has been set" do
8
+ it 'creates an empty style' do
9
+ expect ( style . to_s ) . to eq ( "set style line #{ index } " )
10
+ end
11
+ end
12
+
13
+ context 'when setting the stype' do
14
+ before do
15
+ style . ls = 1
16
+ style . lw = 2
17
+ style . lc = 3
18
+ style . pt = 4
19
+ style . ps = 5
20
+ style . fs = 6
21
+ end
22
+
23
+ it 'creates and indexes the style' do
24
+ expect ( style . to_s ) . to eq (
25
+ "set style line #{ index } ls 1 lw 2 lc 3 pt 4 ps 5 fs 6"
26
+ )
27
+ end
28
+ end
29
+
30
+ context 'when setting the stype on initialize' do
31
+ subject ( :style ) do
32
+ described_class . new do |style |
33
+ style . ls = 1
34
+ style . lw = 2
35
+ style . lc = 3
36
+ style . pt = 4
37
+ style . ps = 5
38
+ style . fs = 6
39
+ end
40
+ end
41
+
42
+ it 'creates and indexes the style' do
43
+ expect ( style . to_s ) . to eq (
44
+ "set style line #{ index } ls 1 lw 2 lc 3 pt 4 ps 5 fs 6"
45
+ )
46
+ end
47
+ end
48
+
49
+ context 'when setting using the full method name' do
50
+ before do
51
+ style . linestyle = 1
52
+ style . linewidth = 2
53
+ style . linecolor = 3
54
+ style . pointtype = 4
55
+ style . pointsize = 5
56
+ style . fill = 6
57
+ end
58
+
59
+ it 'creates and indexes the style' do
60
+ expect ( style . to_s ) . to eq (
61
+ "set style line #{ index } ls 1 lw 2 lc 3 pt 4 ps 5 fs 6"
62
+ )
63
+ end
64
+ end
65
+ end
5
66
end
You can’t perform that action at this time.
0 commit comments