Skip to content

Commit 6cd22ae

Browse files
committed
Add quotting sets spec
1 parent 67245c7 commit 6cd22ae

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spec/lib/ruby_gnuplot/plot_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
shared_examples 'quotes value when setting in a plot for' do |field|
2+
describe "##{field}" do
3+
before do
4+
plot.public_send(field, 'text')
5+
end
6+
7+
it 'quotes value when setting it' do
8+
expect(plot.to_gplot).to eq("set #{field} \"text\"\n")
9+
end
10+
end
11+
end
12+
113
describe Gnuplot::Plot do
214
subject(:plot) { described_class.new }
315

@@ -64,4 +76,14 @@
6476
end
6577
end
6678
end
79+
80+
it_behaves_like 'quotes value when setting in a plot for', :title
81+
it_behaves_like 'quotes value when setting in a plot for', :output
82+
it_behaves_like 'quotes value when setting in a plot for', :xlabel
83+
it_behaves_like 'quotes value when setting in a plot for', :x2label
84+
it_behaves_like 'quotes value when setting in a plot for', :ylabel
85+
it_behaves_like 'quotes value when setting in a plot for', :y2label
86+
it_behaves_like 'quotes value when setting in a plot for', :clabel
87+
it_behaves_like 'quotes value when setting in a plot for', :cblabel
88+
it_behaves_like 'quotes value when setting in a plot for', :zlabel
6789
end

0 commit comments

Comments
 (0)