|
86 | 86 | it_behaves_like 'quotes value when setting in a plot for', :clabel
|
87 | 87 | it_behaves_like 'quotes value when setting in a plot for', :cblabel
|
88 | 88 | it_behaves_like 'quotes value when setting in a plot for', :zlabel
|
| 89 | + |
| 90 | + describe '[]' do |
| 91 | + context 'when value was never set' do |
| 92 | + it { expect(plot['key']).to be_nil } |
| 93 | + end |
| 94 | + |
| 95 | + context 'when value was only unset' do |
| 96 | + before { plot.unset 'title' } |
| 97 | + |
| 98 | + it { expect(plot['title']).to be_nil } |
| 99 | + end |
| 100 | + |
| 101 | + context 'when value was set only once' do |
| 102 | + before { plot.title "My Title" } |
| 103 | + |
| 104 | + it "returns the value to be used (quoted when needed)" do |
| 105 | + expect(plot['title']).to eq('"My Title"') |
| 106 | + end |
| 107 | + end |
| 108 | + |
| 109 | + context 'when value was set twice' do |
| 110 | + before do |
| 111 | + plot.title "My Title" |
| 112 | + plot.title "My New Title" |
| 113 | + end |
| 114 | + |
| 115 | + # TODO: check specification |
| 116 | + xit "returns the last value set" do |
| 117 | + expect(plot['title']).to eq('"My New Title"') |
| 118 | + end |
| 119 | + end |
| 120 | + |
| 121 | + context 'when value was set then unset' do |
| 122 | + before do |
| 123 | + plot.title "My Title" |
| 124 | + plot.unset "title" |
| 125 | + end |
| 126 | + |
| 127 | + # TODO: check specification |
| 128 | + xit { expect(plot['title']).to be_nil } |
| 129 | + end |
| 130 | + |
| 131 | + context 'when value was set, unset and set again' do |
| 132 | + before do |
| 133 | + plot.title "My Title" |
| 134 | + plot.unset "title" |
| 135 | + plot.title "My New Title" |
| 136 | + end |
| 137 | + |
| 138 | + # TODO: check specification |
| 139 | + xit "returns the last value set" do |
| 140 | + expect(plot['title']).to eq('"My New Title"') |
| 141 | + end |
| 142 | + end |
| 143 | + end |
89 | 144 | end
|
0 commit comments