Skip to content

Commit 6decfe0

Browse files
committed
Add spec for data set with properties
1 parent 1564edc commit 6decfe0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

spec/lib/ruby_gnuplot/data_set_spec.rb

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
describe Gnuplot::DataSet do
44
subject(:data_set) { described_class.new(data) }
55

6+
let(:data) { nil }
7+
68
describe '#to_gplot' do
79
context 'when data is an empty array' do
810
let(:data) { [] }
@@ -41,8 +43,6 @@
4143
end
4244

4345
context 'when data is nil' do
44-
let(:data) { nil }
45-
4646
it do
4747
expect(data_set.to_gplot).to be_nil
4848
end
@@ -51,5 +51,20 @@
5151
expect(data_set.data).to eq(data)
5252
end
5353
end
54+
55+
context 'when setting attributes' do
56+
subject(:data_set) do
57+
described_class.new do |ds|
58+
ds.with = 'lines'
59+
ds.using = '1:2'
60+
ds.data = [ [0, 1, 2], [1, 2, 5] ]
61+
end
62+
end
63+
64+
it 'returns only the data' do
65+
expect(data_set.to_gplot)
66+
.to eq("0 1\n1 2\n2 5\ne")
67+
end
68+
end
5469
end
5570
end

0 commit comments

Comments
 (0)