Skip to content

Commit cf8c502

Browse files
committed
Fix Plot#[]
1 parent b442433 commit cf8c502

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/gnuplot.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def unset ( var )
140140
# gnuplot process.
141141

142142
def [] ( var )
143-
v = @settings.rassoc( var )
143+
v = @settings.reverse.rassoc( var )
144144
if v.nil? or v.first == :unset
145145
nil
146146
else

spec/lib/ruby_gnuplot/plot_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@
111111
end
112112

113113
# TODO: check specification
114-
xit 'changes value in current settings' do
114+
it 'changes value in current settings' do
115115
expect { plot.unset 'title' }
116116
.to change { plot['title'] }
117-
.from('My title').to(nil)
117+
.from('"My Title"').to(nil)
118118
end
119119

120120
it 'unsets key on output' do
@@ -149,7 +149,7 @@
149149
end
150150

151151
# TODO: check specification
152-
xit "returns the last value set" do
152+
it "returns the last value set" do
153153
expect(plot['title']).to eq('"My New Title"')
154154
end
155155
end
@@ -161,7 +161,7 @@
161161
end
162162

163163
# TODO: check specification
164-
xit { expect(plot['title']).to be_nil }
164+
it { expect(plot['title']).to be_nil }
165165
end
166166

167167
context 'when value was set, unset and set again' do
@@ -172,7 +172,7 @@
172172
end
173173

174174
# TODO: check specification
175-
xit "returns the last value set" do
175+
it "returns the last value set" do
176176
expect(plot['title']).to eq('"My New Title"')
177177
end
178178
end

0 commit comments

Comments
 (0)