0 | |
From: Antonio Terceiro <terceiro@debian.org>
|
1 | |
Date: Sun, 5 Jun 2016 10:27:34 -0300
|
2 | |
Subject: Port test suite to RSpec 3
|
3 | |
|
4 | |
transpec did all the work
|
5 | |
---
|
6 | |
iniparse.gemspec | 2 +-
|
7 | |
spec/document_spec.rb | 44 +++---
|
8 | |
spec/fixture_spec.rb | 105 +++++++-------
|
9 | |
spec/generator/method_missing_spec.rb | 26 ++--
|
10 | |
spec/generator/with_section_blocks_spec.rb | 80 +++++------
|
11 | |
spec/generator/without_section_blocks_spec.rb | 32 ++---
|
12 | |
spec/iniparse_spec.rb | 8 +-
|
13 | |
spec/line_collection_spec.rb | 76 +++++-----
|
14 | |
spec/lines_spec.rb | 200 +++++++++++++-------------
|
15 | |
spec/parser/document_parsing_spec.rb | 50 +++----
|
16 | |
spec/parser/line_parsing_spec.rb | 130 ++++++++---------
|
17 | |
spec/spec_helper.rb | 4 +-
|
18 | |
spec/spec_helper_spec.rb | 76 +++++-----
|
19 | |
13 files changed, 417 insertions(+), 416 deletions(-)
|
20 | |
|
21 | |
diff --git a/iniparse.gemspec b/iniparse.gemspec
|
22 | |
index 7fec34d..bb54bb9 100644
|
23 | |
--- a/iniparse.gemspec
|
24 | |
+++ b/iniparse.gemspec
|
25 | |
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
26 | |
s.extra_rdoc_files = %w(LICENSE README.rdoc)
|
27 | |
|
28 | |
# Dependencies.
|
29 | |
- s.add_development_dependency('rspec', '~> 2.14')
|
30 | |
+ s.add_development_dependency('rspec', '~> 3.4')
|
31 | |
|
32 | |
# = MANIFEST =
|
33 | |
s.files = %w[
|
34 | |
diff --git a/spec/document_spec.rb b/spec/document_spec.rb
|
35 | |
index 353a7d8..24081f5 100644
|
36 | |
--- a/spec/document_spec.rb
|
37 | |
+++ b/spec/document_spec.rb
|
38 | |
@@ -3,28 +3,28 @@ require 'spec_helper'
|
39 | |
describe "IniParse::Document" do
|
40 | |
it 'should have a +lines+ reader' do
|
41 | |
methods = IniParse::Document.instance_methods.map { |m| m.to_sym }
|
42 | |
- methods.should include(:lines)
|
43 | |
+ expect(methods).to include(:lines)
|
44 | |
end
|
45 | |
|
46 | |
it 'should not have a +lines+ writer' do
|
47 | |
methods = IniParse::Document.instance_methods.map { |m| m.to_sym }
|
48 | |
- methods.should_not include(:lines=)
|
49 | |
+ expect(methods).not_to include(:lines=)
|
50 | |
end
|
51 | |
|
52 | |
it 'should delegate #[] to +lines+' do
|
53 | |
doc = IniParse::Document.new
|
54 | |
- doc.lines.should_receive(:[]).with('key')
|
55 | |
+ expect(doc.lines).to receive(:[]).with('key')
|
56 | |
doc['key']
|
57 | |
end
|
58 | |
|
59 | |
it 'should call #each to +lines+' do
|
60 | |
doc = IniParse::Document.new
|
61 | |
- doc.lines.should_receive(:each)
|
62 | |
+ expect(doc.lines).to receive(:each)
|
63 | |
doc.each { |l| }
|
64 | |
end
|
65 | |
|
66 | |
it 'should be enumerable' do
|
67 | |
- IniParse::Document.included_modules.should include(Enumerable)
|
68 | |
+ expect(IniParse::Document.included_modules).to include(Enumerable)
|
69 | |
|
70 | |
sections = [
|
71 | |
IniParse::Lines::Section.new('first section'),
|
72 | |
@@ -34,7 +34,7 @@ describe "IniParse::Document" do
|
73 | |
doc = IniParse::Document.new
|
74 | |
doc.lines << sections[0] << sections[1]
|
75 | |
|
76 | |
- doc.map { |line| line }.should == sections
|
77 | |
+ expect(doc.map { |line| line }).to eq(sections)
|
78 | |
end
|
79 | |
|
80 | |
describe '#has_section?' do
|
81 | |
@@ -45,12 +45,12 @@ describe "IniParse::Document" do
|
82 | |
end
|
83 | |
|
84 | |
it 'should return true if a section with the given key exists' do
|
85 | |
- @doc.should have_section('first section')
|
86 | |
- @doc.should have_section('another section')
|
87 | |
+ expect(@doc).to have_section('first section')
|
88 | |
+ expect(@doc).to have_section('another section')
|
89 | |
end
|
90 | |
|
91 | |
it 'should return true if no section with the given key exists' do
|
92 | |
- @doc.should_not have_section('second section')
|
93 | |
+ expect(@doc).not_to have_section('second section')
|
94 | |
end
|
95 | |
end
|
96 | |
|
97 | |
@@ -70,22 +70,22 @@ describe "IniParse::Document" do
|
98 | |
end
|
99 | |
|
100 | |
it 'removes the section given a key' do
|
101 | |
- lambda { document.delete('first') }.
|
102 | |
- should change { document['first'] }.to(nil)
|
103 | |
+ expect { document.delete('first') }.
|
104 | |
+ to change { document['first'] }.to(nil)
|
105 | |
end
|
106 | |
|
107 | |
it 'removes the section given a Section' do
|
108 | |
- lambda { document.delete(document['first']) }.
|
109 | |
- should change { document['first'] }.to(nil)
|
110 | |
+ expect { document.delete(document['first']) }.
|
111 | |
+ to change { document['first'] }.to(nil)
|
112 | |
end
|
113 | |
|
114 | |
it 'removes the lines' do
|
115 | |
- lambda { document.delete('first') }.
|
116 | |
- should change { document.to_ini.match(/alpha/) }.to(nil)
|
117 | |
+ expect { document.delete('first') }.
|
118 | |
+ to change { document.to_ini.match(/alpha/) }.to(nil)
|
119 | |
end
|
120 | |
|
121 | |
it 'returns the document' do
|
122 | |
- document.delete('first').should eql(document)
|
123 | |
+ expect(document.delete('first')).to eql(document)
|
124 | |
end
|
125 | |
end
|
126 | |
|
127 | |
@@ -122,31 +122,31 @@ describe "IniParse::Document" do
|
128 | |
describe 'when no path is given to save' do
|
129 | |
it 'should save the INI document if a path was given when initialized' do
|
130 | |
doc = IniParse::Document.new('/a/path/to/a/file.ini')
|
131 | |
- File.should_receive(:open).with('/a/path/to/a/file.ini', 'w')
|
132 | |
+ expect(File).to receive(:open).with('/a/path/to/a/file.ini', 'w')
|
133 | |
doc.save
|
134 | |
end
|
135 | |
|
136 | |
it 'should raise IniParseError if no path was given when initialized' do
|
137 | |
- lambda { IniParse::Document.new.save }.should \
|
138 | |
+ expect { IniParse::Document.new.save }.to \
|
139 | |
raise_error(IniParse::IniParseError)
|
140 | |
end
|
141 | |
end
|
142 | |
|
143 | |
describe 'when a path is given to save' do
|
144 | |
it "should update the document's +path+" do
|
145 | |
- File.stub(:open).and_return(true)
|
146 | |
+ allow(File).to receive(:open).and_return(true)
|
147 | |
doc = IniParse::Document.new('/a/path/to/a/file.ini')
|
148 | |
doc.save('/a/new/path.ini')
|
149 | |
- doc.path.should == '/a/new/path.ini'
|
150 | |
+ expect(doc.path).to eq('/a/new/path.ini')
|
151 | |
end
|
152 | |
|
153 | |
it 'should save the INI document to the given path' do
|
154 | |
- File.should_receive(:open).with('/a/new/path.ini', 'w')
|
155 | |
+ expect(File).to receive(:open).with('/a/new/path.ini', 'w')
|
156 | |
IniParse::Document.new('/a/path/to/a/file.ini').save('/a/new/path.ini')
|
157 | |
end
|
158 | |
|
159 | |
it 'should raise IniParseError if no path was given when initialized' do
|
160 | |
- lambda { IniParse::Document.new.save }.should \
|
161 | |
+ expect { IniParse::Document.new.save }.to \
|
162 | |
raise_error(IniParse::IniParseError)
|
163 | |
end
|
164 | |
end
|
165 | |
diff --git a/spec/fixture_spec.rb b/spec/fixture_spec.rb
|
166 | |
index 81eab3c..0c3c8e4 100644
|
167 | |
--- a/spec/fixture_spec.rb
|
168 | |
+++ b/spec/fixture_spec.rb
|
169 | |
@@ -7,16 +7,16 @@ describe "IniParse" do
|
170 | |
end
|
171 | |
|
172 | |
it 'should parse without any errors' do
|
173 | |
- lambda { IniParse.parse(@fixture) }.should_not raise_error
|
174 | |
+ expect { IniParse.parse(@fixture) }.not_to raise_error
|
175 | |
end
|
176 | |
|
177 | |
it 'should have the correct sections' do
|
178 | |
- IniParse.parse(fixture('openttd.ini')).lines.keys.should == [
|
179 | |
+ expect(IniParse.parse(fixture('openttd.ini')).lines.keys).to eq([
|
180 | |
'misc', 'music', 'difficulty', 'game_creation', 'vehicle',
|
181 | |
'construction', 'station', 'economy', 'pf', 'order', 'gui', 'ai',
|
182 | |
'locale', 'network', 'currency', 'servers', 'bans', 'news_display',
|
183 | |
'version', 'preset-J', 'newgrf', 'newgrf-static'
|
184 | |
- ]
|
185 | |
+ ])
|
186 | |
end
|
187 | |
|
188 | |
it 'should have the correct options' do
|
189 | |
@@ -24,7 +24,7 @@ describe "IniParse" do
|
190 | |
doc = IniParse.parse(@fixture)
|
191 | |
section = doc['misc']
|
192 | |
|
193 | |
- section.lines.keys.should == [
|
194 | |
+ expect(section.lines.keys).to eq([
|
195 | |
'display_opt', 'news_ticker_sound', 'fullscreen', 'language',
|
196 | |
'resolution', 'screenshot_format', 'savegame_format',
|
197 | |
'rightclick_emulate', 'small_font', 'medium_font', 'large_font',
|
198 | |
@@ -32,26 +32,26 @@ describe "IniParse" do
|
199 | |
'large_aa', 'sprite_cache_size', 'player_face',
|
200 | |
'transparency_options', 'transparency_locks', 'invisibility_options',
|
201 | |
'keyboard', 'keyboard_caps'
|
202 | |
- ]
|
203 | |
+ ])
|
204 | |
|
205 | |
# Test some of the options.
|
206 | |
- section['display_opt'].should == 'SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|FULL_DETAIL|WAYPOINTS'
|
207 | |
- section['news_ticker_sound'].should be_false
|
208 | |
- section['language'].should == 'english_US.lng'
|
209 | |
- section['resolution'].should == '1680,936'
|
210 | |
- section['large_size'].should == 16
|
211 | |
+ expect(section['display_opt']).to eq('SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|FULL_DETAIL|WAYPOINTS')
|
212 | |
+ expect(section['news_ticker_sound']).to be_falsey
|
213 | |
+ expect(section['language']).to eq('english_US.lng')
|
214 | |
+ expect(section['resolution']).to eq('1680,936')
|
215 | |
+ expect(section['large_size']).to eq(16)
|
216 | |
|
217 | |
# Test some other options.
|
218 | |
- doc['currency']['suffix'].should == '" credits"'
|
219 | |
- doc['news_display']['production_nobody'].should == 'summarized'
|
220 | |
- doc['version']['version_number'].should == '070039B0'
|
221 | |
+ expect(doc['currency']['suffix']).to eq('" credits"')
|
222 | |
+ expect(doc['news_display']['production_nobody']).to eq('summarized')
|
223 | |
+ expect(doc['version']['version_number']).to eq('070039B0')
|
224 | |
|
225 | |
- doc['preset-J']['gcf/1_other/BlackCC/mauvetoblackw.grf'].should be_nil
|
226 | |
- doc['preset-J']['gcf/1_other/OpenGFX/OpenGFX_-_newFaces_v0.1.grf'].should be_nil
|
227 | |
+ expect(doc['preset-J']['gcf/1_other/BlackCC/mauvetoblackw.grf']).to be_nil
|
228 | |
+ expect(doc['preset-J']['gcf/1_other/OpenGFX/OpenGFX_-_newFaces_v0.1.grf']).to be_nil
|
229 | |
end
|
230 | |
|
231 | |
it 'should be identical to the original when calling #to_ini' do
|
232 | |
- IniParse.parse(@fixture).to_ini.should == @fixture
|
233 | |
+ expect(IniParse.parse(@fixture).to_ini).to eq(@fixture)
|
234 | |
end
|
235 | |
end
|
236 | |
|
237 | |
@@ -61,14 +61,14 @@ describe "IniParse" do
|
238 | |
end
|
239 | |
|
240 | |
it 'should parse without any errors' do
|
241 | |
- lambda { IniParse.parse(@fixture) }.should_not raise_error
|
242 | |
+ expect { IniParse.parse(@fixture) }.not_to raise_error
|
243 | |
end
|
244 | |
|
245 | |
it 'should have the correct sections' do
|
246 | |
- IniParse.parse(fixture('race07.ini')).lines.keys.should == [
|
247 | |
+ expect(IniParse.parse(fixture('race07.ini')).lines.keys).to eq([
|
248 | |
'Header', 'Race', 'Slot010', 'Slot016', 'Slot013', 'Slot018',
|
249 | |
'Slot002', 'END'
|
250 | |
- ]
|
251 | |
+ ])
|
252 | |
end
|
253 | |
|
254 | |
it 'should have the correct options' do
|
255 | |
@@ -76,24 +76,24 @@ describe "IniParse" do
|
256 | |
doc = IniParse.parse(@fixture)
|
257 | |
section = doc['Slot010']
|
258 | |
|
259 | |
- section.lines.keys.should == [
|
260 | |
+ expect(section.lines.keys).to eq([
|
261 | |
'Driver', 'SteamUser', 'SteamId', 'Vehicle', 'Team', 'QualTime',
|
262 | |
'Laps', 'Lap', 'LapDistanceTravelled', 'BestLap', 'RaceTime'
|
263 | |
- ]
|
264 | |
+ ])
|
265 | |
|
266 | |
# Test some of the options.
|
267 | |
- section['Driver'].should == 'Mark Voss'
|
268 | |
- section['SteamUser'].should == 'mvoss'
|
269 | |
- section['SteamId'].should == 1865369
|
270 | |
- section['Vehicle'].should == 'Chevrolet Lacetti 2007'
|
271 | |
- section['Team'].should == 'TEMPLATE_TEAM'
|
272 | |
- section['QualTime'].should == '1:37.839'
|
273 | |
- section['Laps'].should == 13
|
274 | |
- section['LapDistanceTravelled'].should == 3857.750244
|
275 | |
- section['BestLap'].should == '1:38.031'
|
276 | |
- section['RaceTime'].should == '0:21:38.988'
|
277 | |
-
|
278 | |
- section['Lap'].should == [
|
279 | |
+ expect(section['Driver']).to eq('Mark Voss')
|
280 | |
+ expect(section['SteamUser']).to eq('mvoss')
|
281 | |
+ expect(section['SteamId']).to eq(1865369)
|
282 | |
+ expect(section['Vehicle']).to eq('Chevrolet Lacetti 2007')
|
283 | |
+ expect(section['Team']).to eq('TEMPLATE_TEAM')
|
284 | |
+ expect(section['QualTime']).to eq('1:37.839')
|
285 | |
+ expect(section['Laps']).to eq(13)
|
286 | |
+ expect(section['LapDistanceTravelled']).to eq(3857.750244)
|
287 | |
+ expect(section['BestLap']).to eq('1:38.031')
|
288 | |
+ expect(section['RaceTime']).to eq('0:21:38.988')
|
289 | |
+
|
290 | |
+ expect(section['Lap']).to eq([
|
291 | |
'(0, -1.000, 1:48.697)', '(1, 89.397, 1:39.455)',
|
292 | |
'(2, 198.095, 1:38.060)', '(3, 297.550, 1:38.632)',
|
293 | |
'(4, 395.610, 1:38.031)', '(5, 494.242, 1:39.562)',
|
294 | |
@@ -101,20 +101,19 @@ describe "IniParse" do
|
295 | |
'(8, 791.785, 1:39.889)', '(9, 890.151, 1:39.420)',
|
296 | |
'(10, 990.040, 1:39.401)', '(11, 1089.460, 1:39.506)',
|
297 | |
'(12, 1188.862, 1:40.017)'
|
298 | |
- ]
|
299 | |
+ ])
|
300 | |
|
301 | |
- doc['Header']['Version'].should == '1.1.1.14'
|
302 | |
- doc['Header']['TimeString'].should == '2008/09/13 23:26:32'
|
303 | |
- doc['Header']['Aids'].should == '0,0,0,0,0,1,1,0,0'
|
304 | |
+ expect(doc['Header']['Version']).to eq('1.1.1.14')
|
305 | |
+ expect(doc['Header']['TimeString']).to eq('2008/09/13 23:26:32')
|
306 | |
+ expect(doc['Header']['Aids']).to eq('0,0,0,0,0,1,1,0,0')
|
307 | |
|
308 | |
- doc['Race']['AIDB'].should == 'GameData\Locations\Anderstorp_2007\2007_ANDERSTORP.AIW'
|
309 | |
- doc['Race']['Race Length'].should == 0.1
|
310 | |
+ expect(doc['Race']['AIDB']).to eq('GameData\Locations\Anderstorp_2007\2007_ANDERSTORP.AIW')
|
311 | |
+ expect(doc['Race']['Race Length']).to eq(0.1)
|
312 | |
end
|
313 | |
|
314 | |
it 'should be identical to the original when calling #to_ini' do
|
315 | |
- pending('awaiting presevation (or lack) of whitespace around =') do
|
316 | |
- IniParse.parse(@fixture).to_ini.should == @fixture
|
317 | |
- end
|
318 | |
+ pending('awaiting presevation (or lack) of whitespace around =')
|
319 | |
+ expect(IniParse.parse(@fixture).to_ini).to eq(@fixture)
|
320 | |
end
|
321 | |
end
|
322 | |
|
323 | |
@@ -124,13 +123,13 @@ describe "IniParse" do
|
324 | |
end
|
325 | |
|
326 | |
it 'should parse without any errors' do
|
327 | |
- lambda { IniParse.parse(@fixture) }.should_not raise_error
|
328 | |
+ expect { IniParse.parse(@fixture) }.not_to raise_error
|
329 | |
end
|
330 | |
|
331 | |
it 'should have the correct sections' do
|
332 | |
- IniParse.parse(@fixture).lines.keys.should == [
|
333 | |
+ expect(IniParse.parse(@fixture).lines.keys).to eq([
|
334 | |
'global', 'printers'
|
335 | |
- ]
|
336 | |
+ ])
|
337 | |
end
|
338 | |
|
339 | |
it 'should have the correct options' do
|
340 | |
@@ -138,7 +137,7 @@ describe "IniParse" do
|
341 | |
doc = IniParse.parse(@fixture)
|
342 | |
section = doc['global']
|
343 | |
|
344 | |
- section.lines.keys.should == [
|
345 | |
+ expect(section.lines.keys).to eq([
|
346 | |
'debug pid', 'log level', 'server string', 'printcap name',
|
347 | |
'printing', 'encrypt passwords', 'use spnego', 'passdb backend',
|
348 | |
'idmap domains', 'idmap config default: default',
|
349 | |
@@ -152,15 +151,15 @@ describe "IniParse" do
|
350 | |
'usershare allow full config', 'com.apple:filter shares by access',
|
351 | |
'obey pam restrictions', 'acl check permissions',
|
352 | |
'name resolve order', 'include'
|
353 | |
- ]
|
354 | |
+ ])
|
355 | |
|
356 | |
- section['display charset'].should == 'UTF-8-MAC'
|
357 | |
- section['vfs objects'].should == 'darwinacl,darwin_streams'
|
358 | |
- section['usershare path'].should == '/var/samba/shares'
|
359 | |
+ expect(section['display charset']).to eq('UTF-8-MAC')
|
360 | |
+ expect(section['vfs objects']).to eq('darwinacl,darwin_streams')
|
361 | |
+ expect(section['usershare path']).to eq('/var/samba/shares')
|
362 | |
end
|
363 | |
|
364 | |
it 'should be identical to the original when calling #to_ini' do
|
365 | |
- IniParse.parse(@fixture).to_ini.should == @fixture
|
366 | |
+ expect(IniParse.parse(@fixture).to_ini).to eq(@fixture)
|
367 | |
end
|
368 | |
end
|
369 | |
|
370 | |
@@ -170,7 +169,7 @@ describe "IniParse" do
|
371 | |
end
|
372 | |
|
373 | |
it 'should be identical to the original when calling #to_ini' do
|
374 | |
- IniParse.parse(@fixture).to_ini.should == @fixture
|
375 | |
+ expect(IniParse.parse(@fixture).to_ini).to eq(@fixture)
|
376 | |
end
|
377 | |
end
|
378 | |
|
379 | |
@@ -180,7 +179,7 @@ describe "IniParse" do
|
380 | |
end
|
381 | |
|
382 | |
it 'should be identical to the original when calling #to_ini' do
|
383 | |
- IniParse.parse(@fixture).to_ini.should == @fixture
|
384 | |
+ expect(IniParse.parse(@fixture).to_ini).to eq(@fixture)
|
385 | |
end
|
386 | |
end
|
387 | |
end
|
388 | |
diff --git a/spec/generator/method_missing_spec.rb b/spec/generator/method_missing_spec.rb
|
389 | |
index 9fc1540..9370cb1 100644
|
390 | |
--- a/spec/generator/method_missing_spec.rb
|
391 | |
+++ b/spec/generator/method_missing_spec.rb
|
392 | |
@@ -23,23 +23,23 @@ describe 'When generating a document using Generator with section blocks using m
|
393 | |
IniParse::Generator.gen do |doc|
|
394 | |
doc.a_section do |section|
|
395 | |
%w( option comment blank ).each do |meth|
|
396 | |
- section.should respond_to(meth)
|
397 | |
+ expect(section).to respond_to(meth)
|
398 | |
end
|
399 | |
end
|
400 | |
end
|
401 | |
end
|
402 | |
|
403 | |
it 'should add a Section to the document' do
|
404 | |
- IniParse::Generator.gen do |doc|
|
405 | |
+ expect(IniParse::Generator.gen do |doc|
|
406 | |
doc.a_section { |section| }
|
407 | |
- end.should have_section("a_section")
|
408 | |
+ end).to have_section("a_section")
|
409 | |
end
|
410 | |
|
411 | |
it 'should change the Generator context to the section during the section block' do
|
412 | |
IniParse::Generator.gen do |doc|
|
413 | |
doc.a_section do |section|
|
414 | |
- section.context.should be_kind_of(IniParse::Lines::Section)
|
415 | |
- section.context.key.should == "a_section"
|
416 | |
+ expect(section.context).to be_kind_of(IniParse::Lines::Section)
|
417 | |
+ expect(section.context.key).to eq("a_section")
|
418 | |
end
|
419 | |
end
|
420 | |
end
|
421 | |
@@ -47,24 +47,24 @@ describe 'When generating a document using Generator with section blocks using m
|
422 | |
it 'should reset the Generator context to the document after the section block' do
|
423 | |
IniParse::Generator.gen do |doc|
|
424 | |
doc.a_section { |section| }
|
425 | |
- doc.context.should be_kind_of(IniParse::Document)
|
426 | |
+ expect(doc.context).to be_kind_of(IniParse::Document)
|
427 | |
end
|
428 | |
end
|
429 | |
|
430 | |
it 'should append a blank line to the document, after the section' do
|
431 | |
- IniParse::Generator.gen do |doc|
|
432 | |
+ expect(IniParse::Generator.gen do |doc|
|
433 | |
doc.a_section { |section| }
|
434 | |
- end.lines.to_a.last.should be_kind_of(IniParse::Lines::Blank)
|
435 | |
+ end.lines.to_a.last).to be_kind_of(IniParse::Lines::Blank)
|
436 | |
end
|
437 | |
|
438 | |
it 'should raise a LineNotAllowed if you attempt to nest a section' do
|
439 | |
- lambda do
|
440 | |
+ expect do
|
441 | |
IniParse::Generator.gen do |doc|
|
442 | |
doc.a_section do |section_one|
|
443 | |
section_one.another_section { |section_two| }
|
444 | |
end
|
445 | |
end
|
446 | |
- end.should raise_error(IniParse::LineNotAllowed)
|
447 | |
+ end.to raise_error(IniParse::LineNotAllowed)
|
448 | |
end
|
449 | |
end
|
450 | |
|
451 | |
@@ -78,7 +78,7 @@ describe 'When generating a document using Generator with section blocks using m
|
452 | |
describe 'when the context is a Document' do
|
453 | |
it "adds the option to an __anonymous__ section" do
|
454 | |
doc = IniParse::Generator.gen { |doc| doc.my_option = "a value" }
|
455 | |
- doc['__anonymous__']['my_option'].should eql('a value')
|
456 | |
+ expect(doc['__anonymous__']['my_option']).to eql('a value')
|
457 | |
end
|
458 | |
end
|
459 | |
|
460 | |
@@ -91,8 +91,8 @@ describe 'When generating a document using Generator with section blocks using m
|
461 | |
end
|
462 | |
|
463 | |
section = document["a_section"]
|
464 | |
- section.should have_option("my_option")
|
465 | |
- section["my_option"].should == "a value"
|
466 | |
+ expect(section).to have_option("my_option")
|
467 | |
+ expect(section["my_option"]).to eq("a value")
|
468 | |
end
|
469 | |
end
|
470 | |
end
|
471 | |
diff --git a/spec/generator/with_section_blocks_spec.rb b/spec/generator/with_section_blocks_spec.rb
|
472 | |
index da82840..4af5009 100644
|
473 | |
--- a/spec/generator/with_section_blocks_spec.rb
|
474 | |
+++ b/spec/generator/with_section_blocks_spec.rb
|
475 | |
@@ -13,17 +13,17 @@ require 'spec_helper'
|
476 | |
describe 'When generating a document using Generator with section blocks,' do
|
477 | |
|
478 | |
it 'should be able to compile an empty document' do
|
479 | |
- lambda { IniParse::Generator.gen { |doc| } }.should_not raise_error
|
480 | |
+ expect { IniParse::Generator.gen { |doc| } }.not_to raise_error
|
481 | |
end
|
482 | |
|
483 | |
it 'should raise LocalJumpError if no block is given' do
|
484 | |
- lambda { IniParse::Generator.gen }.should raise_error(LocalJumpError)
|
485 | |
+ expect { IniParse::Generator.gen }.to raise_error(LocalJumpError)
|
486 | |
end
|
487 | |
|
488 | |
it "should yield an object with generator methods" do
|
489 | |
IniParse::Generator.gen do |doc|
|
490 | |
%w( section option comment blank ).each do |meth|
|
491 | |
- doc.should respond_to(meth)
|
492 | |
+ expect(doc).to respond_to(meth)
|
493 | |
end
|
494 | |
end
|
495 | |
end
|
496 | |
@@ -39,23 +39,23 @@ describe 'When generating a document using Generator with section blocks,' do
|
497 | |
IniParse::Generator.gen do |doc|
|
498 | |
doc.section("a section") do |section|
|
499 | |
%w( option comment blank ).each do |meth|
|
500 | |
- section.should respond_to(meth)
|
501 | |
+ expect(section).to respond_to(meth)
|
502 | |
end
|
503 | |
end
|
504 | |
end
|
505 | |
end
|
506 | |
|
507 | |
it 'should add a Section to the document' do
|
508 | |
- IniParse::Generator.gen do |doc|
|
509 | |
+ expect(IniParse::Generator.gen do |doc|
|
510 | |
doc.section("a section") { |section| }
|
511 | |
- end.should have_section("a section")
|
512 | |
+ end).to have_section("a section")
|
513 | |
end
|
514 | |
|
515 | |
it 'should change the Generator context to the section during the section block' do
|
516 | |
IniParse::Generator.gen do |doc|
|
517 | |
doc.section("a section") do |section|
|
518 | |
- section.context.should be_kind_of(IniParse::Lines::Section)
|
519 | |
- section.context.key.should == "a section"
|
520 | |
+ expect(section.context).to be_kind_of(IniParse::Lines::Section)
|
521 | |
+ expect(section.context.key).to eq("a section")
|
522 | |
end
|
523 | |
end
|
524 | |
end
|
525 | |
@@ -63,7 +63,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
526 | |
it 'should reset the Generator context to the document after the section block' do
|
527 | |
IniParse::Generator.gen do |doc|
|
528 | |
doc.section("a section") { |section| }
|
529 | |
- doc.context.should be_kind_of(IniParse::Document)
|
530 | |
+ expect(doc.context).to be_kind_of(IniParse::Document)
|
531 | |
end
|
532 | |
end
|
533 | |
|
534 | |
@@ -72,7 +72,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
535 | |
doc.section("a section") { |section| }
|
536 | |
end
|
537 | |
|
538 | |
- document["a section"].to_ini.should match(/\A /)
|
539 | |
+ expect(document["a section"].to_ini).to match(/\A /)
|
540 | |
end
|
541 | |
|
542 | |
it 'should pass extra options to the Section instance' do
|
543 | |
@@ -80,23 +80,23 @@ describe 'When generating a document using Generator with section blocks,' do
|
544 | |
doc.section("a section", :indent => ' ') { |section| }
|
545 | |
end
|
546 | |
|
547 | |
- document["a section"].to_ini.should match(/\A /)
|
548 | |
+ expect(document["a section"].to_ini).to match(/\A /)
|
549 | |
end
|
550 | |
|
551 | |
it 'should append a blank line to the document, after the section' do
|
552 | |
- IniParse::Generator.gen do |doc|
|
553 | |
+ expect(IniParse::Generator.gen do |doc|
|
554 | |
doc.section("a section") { |section| }
|
555 | |
- end.lines.to_a.last.should be_kind_of(IniParse::Lines::Blank)
|
556 | |
+ end.lines.to_a.last).to be_kind_of(IniParse::Lines::Blank)
|
557 | |
end
|
558 | |
|
559 | |
it 'should raise a LineNotAllowed if you attempt to nest a section' do
|
560 | |
- lambda do
|
561 | |
+ expect do
|
562 | |
IniParse::Generator.gen do |doc|
|
563 | |
doc.section("a section") do |section_one|
|
564 | |
section_one.section("another_section") { |section_two| }
|
565 | |
end
|
566 | |
end
|
567 | |
- end.should raise_error(IniParse::LineNotAllowed)
|
568 | |
+ end.to raise_error(IniParse::LineNotAllowed)
|
569 | |
end
|
570 | |
end
|
571 | |
|
572 | |
@@ -114,7 +114,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
573 | |
doc.option("my option", "a value")
|
574 | |
end
|
575 | |
|
576 | |
- document['__anonymous__']['my option'].should eql('a value')
|
577 | |
+ expect(document['__anonymous__']['my option']).to eql('a value')
|
578 | |
end
|
579 | |
end
|
580 | |
|
581 | |
@@ -127,8 +127,8 @@ describe 'When generating a document using Generator with section blocks,' do
|
582 | |
end
|
583 | |
|
584 | |
section = document["a section"]
|
585 | |
- section.should have_option("my option")
|
586 | |
- section["my option"].should == "a value"
|
587 | |
+ expect(section).to have_option("my option")
|
588 | |
+ expect(section["my option"]).to eq("a value")
|
589 | |
end
|
590 | |
|
591 | |
it 'should pass extra options to the Option instance' do
|
592 | |
@@ -138,7 +138,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
593 | |
end
|
594 | |
end
|
595 | |
|
596 | |
- document["a section"].option("my option").to_ini.should match(/^ /)
|
597 | |
+ expect(document["a section"].option("my option").to_ini).to match(/^ /)
|
598 | |
end
|
599 | |
|
600 | |
it "should use the parent document's options as a base" do
|
601 | |
@@ -148,7 +148,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
602 | |
end
|
603 | |
end
|
604 | |
|
605 | |
- document["a section"].option("my option").to_ini.should match(/^ /)
|
606 | |
+ expect(document["a section"].option("my option").to_ini).to match(/^ /)
|
607 | |
end
|
608 | |
|
609 | |
it "should use the parent section's options as a base" do
|
610 | |
@@ -158,7 +158,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
611 | |
end
|
612 | |
end
|
613 | |
|
614 | |
- document["a section"].option("my option").to_ini.should match(/^ /)
|
615 | |
+ expect(document["a section"].option("my option").to_ini).to match(/^ /)
|
616 | |
end
|
617 | |
|
618 | |
it "should allow customisation of the parent's options" do
|
619 | |
@@ -171,8 +171,8 @@ describe 'When generating a document using Generator with section blocks,' do
|
620 | |
end
|
621 | |
|
622 | |
option_ini = document["a section"].option("my option").to_ini
|
623 | |
- option_ini.should match(/^ /)
|
624 | |
- option_ini.should match(/ # a comment/)
|
625 | |
+ expect(option_ini).to match(/^ /)
|
626 | |
+ expect(option_ini).to match(/ # a comment/)
|
627 | |
end
|
628 | |
|
629 | |
it "should not use the parent section's comment when setting line options" do
|
630 | |
@@ -182,7 +182,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
631 | |
end
|
632 | |
end
|
633 | |
|
634 | |
- document["a section"].option("my option").to_ini.should_not match(/My section$/)
|
635 | |
+ expect(document["a section"].option("my option").to_ini).not_to match(/My section$/)
|
636 | |
end
|
637 | |
end
|
638 | |
end
|
639 | |
@@ -199,7 +199,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
640 | |
doc.comment("My comment", :indent => ' ')
|
641 | |
end
|
642 | |
|
643 | |
- document.lines.to_a.first.to_ini.should match(/\A /)
|
644 | |
+ expect(document.lines.to_a.first.to_ini).to match(/\A /)
|
645 | |
end
|
646 | |
|
647 | |
it 'should ignore any extra :comment option' do
|
648 | |
@@ -207,8 +207,8 @@ describe 'When generating a document using Generator with section blocks,' do
|
649 | |
doc.comment("My comment", :comment => 'Ignored')
|
650 | |
end
|
651 | |
|
652 | |
- document.lines.to_a.first.to_ini.should match(/My comment/)
|
653 | |
- document.lines.to_a.first.to_ini.should_not match(/Ignored/)
|
654 | |
+ expect(document.lines.to_a.first.to_ini).to match(/My comment/)
|
655 | |
+ expect(document.lines.to_a.first.to_ini).not_to match(/Ignored/)
|
656 | |
end
|
657 | |
|
658 | |
describe 'when the context is a Document' do
|
659 | |
@@ -218,8 +218,8 @@ describe 'When generating a document using Generator with section blocks,' do
|
660 | |
end
|
661 | |
|
662 | |
comment = document.lines.to_a.first
|
663 | |
- comment.should be_kind_of(IniParse::Lines::Comment)
|
664 | |
- comment.to_ini.should match(/My comment/)
|
665 | |
+ expect(comment).to be_kind_of(IniParse::Lines::Comment)
|
666 | |
+ expect(comment.to_ini).to match(/My comment/)
|
667 | |
end
|
668 | |
|
669 | |
it 'should use the default line options as a base' do
|
670 | |
@@ -230,7 +230,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
671 | |
comment_ini = document.lines.to_a.first.to_ini
|
672 | |
|
673 | |
# Match separator (;) and offset (0).
|
674 | |
- comment_ini.should == '; My comment'
|
675 | |
+ expect(comment_ini).to eq('; My comment')
|
676 | |
end
|
677 | |
end
|
678 | |
|
679 | |
@@ -243,8 +243,8 @@ describe 'When generating a document using Generator with section blocks,' do
|
680 | |
end
|
681 | |
|
682 | |
comment = document['a section'].lines.to_a.first
|
683 | |
- comment.should be_kind_of(IniParse::Lines::Comment)
|
684 | |
- comment.to_ini.should match(/My comment/)
|
685 | |
+ expect(comment).to be_kind_of(IniParse::Lines::Comment)
|
686 | |
+ expect(comment.to_ini).to match(/My comment/)
|
687 | |
end
|
688 | |
|
689 | |
it "should use the parent document's line options as a base" do
|
690 | |
@@ -254,7 +254,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
691 | |
end
|
692 | |
end
|
693 | |
|
694 | |
- document['a section'].lines.to_a.first.to_ini.should match(/^ ;/)
|
695 | |
+ expect(document['a section'].lines.to_a.first.to_ini).to match(/^ ;/)
|
696 | |
end
|
697 | |
|
698 | |
it "should use the parent section's line options as a base" do
|
699 | |
@@ -264,7 +264,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
700 | |
end
|
701 | |
end
|
702 | |
|
703 | |
- document['a section'].lines.to_a.first.to_ini.should match(/^ ;/)
|
704 | |
+ expect(document['a section'].lines.to_a.first.to_ini).to match(/^ ;/)
|
705 | |
end
|
706 | |
|
707 | |
it "should allow customisation of the parent's options" do
|
708 | |
@@ -275,8 +275,8 @@ describe 'When generating a document using Generator with section blocks,' do
|
709 | |
end
|
710 | |
|
711 | |
# Match separator (#) and offset (5)
|
712 | |
- document['a section'].lines.to_a.first.to_ini.should \
|
713 | |
- == ' # My comment'
|
714 | |
+ expect(document['a section'].lines.to_a.first.to_ini).to \
|
715 | |
+ eq(' # My comment')
|
716 | |
end
|
717 | |
|
718 | |
it "should not use the parent section's comment when setting line options" do
|
719 | |
@@ -287,8 +287,8 @@ describe 'When generating a document using Generator with section blocks,' do
|
720 | |
end
|
721 | |
|
722 | |
comment_ini = document['a section'].lines.to_a.first.to_ini
|
723 | |
- comment_ini.should match(/My comment/)
|
724 | |
- comment_ini.should_not match(/My section/)
|
725 | |
+ expect(comment_ini).to match(/My comment/)
|
726 | |
+ expect(comment_ini).not_to match(/My section/)
|
727 | |
end
|
728 | |
end
|
729 | |
end
|
730 | |
@@ -305,7 +305,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
731 | |
doc.blank
|
732 | |
end
|
733 | |
|
734 | |
- document.lines.to_a.first.should be_kind_of(IniParse::Lines::Blank)
|
735 | |
+ expect(document.lines.to_a.first).to be_kind_of(IniParse::Lines::Blank)
|
736 | |
end
|
737 | |
|
738 | |
it 'should add a blank line to the section when it is the context' do
|
739 | |
@@ -315,7 +315,7 @@ describe 'When generating a document using Generator with section blocks,' do
|
740 | |
end
|
741 | |
end
|
742 | |
|
743 | |
- document['a section'].lines.to_a.first.should be_kind_of(IniParse::Lines::Blank)
|
744 | |
+ expect(document['a section'].lines.to_a.first).to be_kind_of(IniParse::Lines::Blank)
|
745 | |
end
|
746 | |
end
|
747 | |
|
748 | |
diff --git a/spec/generator/without_section_blocks_spec.rb b/spec/generator/without_section_blocks_spec.rb
|
749 | |
index 00e0cea..1aba308 100644
|
750 | |
--- a/spec/generator/without_section_blocks_spec.rb
|
751 | |
+++ b/spec/generator/without_section_blocks_spec.rb
|
752 | |
@@ -29,17 +29,17 @@ describe 'When generating a document using Generator without section blocks,' do
|
753 | |
describe 'adding a section' do
|
754 | |
it 'should add a Section to the document' do
|
755 | |
@gen.section("a section")
|
756 | |
- @gen.document.should have_section("a section")
|
757 | |
+ expect(@gen.document).to have_section("a section")
|
758 | |
end
|
759 | |
|
760 | |
it 'should change the Generator context to the section' do
|
761 | |
@gen.section("a section")
|
762 | |
- @gen.context.should == @gen.document['a section']
|
763 | |
+ expect(@gen.context).to eq(@gen.document['a section'])
|
764 | |
end
|
765 | |
|
766 | |
it 'should pass extra options to the Section instance' do
|
767 | |
@gen.section("a section", :indent => ' ')
|
768 | |
- @gen.document["a section"].to_ini.should match(/\A /)
|
769 | |
+ expect(@gen.document["a section"].to_ini).to match(/\A /)
|
770 | |
end
|
771 | |
end
|
772 | |
|
773 | |
@@ -53,13 +53,13 @@ describe 'When generating a document using Generator without section blocks,' do
|
774 | |
it 'should pass extra options to the Option instance' do
|
775 | |
@gen.section("a section")
|
776 | |
@gen.option("my option", "a value", :indent => ' ')
|
777 | |
- @gen.document["a section"].option("my option").to_ini.should match(/^ /)
|
778 | |
+ expect(@gen.document["a section"].option("my option").to_ini).to match(/^ /)
|
779 | |
end
|
780 | |
|
781 | |
describe 'when the context is a Document' do
|
782 | |
it "should add the option to an __anonymous__ section" do
|
783 | |
@gen.option("key", "value")
|
784 | |
- @gen.document['__anonymous__']['key'].should eql('value')
|
785 | |
+ expect(@gen.document['__anonymous__']['key']).to eql('value')
|
786 | |
end
|
787 | |
end
|
788 | |
|
789 | |
@@ -67,8 +67,8 @@ describe 'When generating a document using Generator without section blocks,' do
|
790 | |
it 'should add the option to the section' do
|
791 | |
@gen.section("a section")
|
792 | |
@gen.option("my option", "a value")
|
793 | |
- @gen.document["a section"].should have_option("my option")
|
794 | |
- @gen.document["a section"]["my option"].should == "a value"
|
795 | |
+ expect(@gen.document["a section"]).to have_option("my option")
|
796 | |
+ expect(@gen.document["a section"]["my option"]).to eq("a value")
|
797 | |
end
|
798 | |
end
|
799 | |
end
|
800 | |
@@ -82,22 +82,22 @@ describe 'When generating a document using Generator without section blocks,' do
|
801 | |
describe 'adding a comment' do
|
802 | |
it 'should pass extra options to the Option instance' do
|
803 | |
@gen.comment("My comment", :indent => ' ')
|
804 | |
- @gen.document.lines.to_a.first.to_ini.should match(/^ /)
|
805 | |
+ expect(@gen.document.lines.to_a.first.to_ini).to match(/^ /)
|
806 | |
end
|
807 | |
|
808 | |
it 'should ignore any extra :comment option' do
|
809 | |
@gen.comment("My comment", :comment => 'Ignored')
|
810 | |
comment_ini = @gen.document.lines.to_a.first.to_ini
|
811 | |
- comment_ini.should match(/My comment/)
|
812 | |
- comment_ini.should_not match(/Ignored/)
|
813 | |
+ expect(comment_ini).to match(/My comment/)
|
814 | |
+ expect(comment_ini).not_to match(/Ignored/)
|
815 | |
end
|
816 | |
|
817 | |
describe 'when the context is a Document' do
|
818 | |
it 'should add a comment to the document' do
|
819 | |
@gen.comment('My comment')
|
820 | |
comment = @gen.document.lines.to_a.first
|
821 | |
- comment.should be_kind_of(IniParse::Lines::Comment)
|
822 | |
- comment.to_ini.should match(/; My comment/)
|
823 | |
+ expect(comment).to be_kind_of(IniParse::Lines::Comment)
|
824 | |
+ expect(comment.to_ini).to match(/; My comment/)
|
825 | |
end
|
826 | |
end
|
827 | |
|
828 | |
@@ -106,8 +106,8 @@ describe 'When generating a document using Generator without section blocks,' do
|
829 | |
@gen.section('a section')
|
830 | |
@gen.comment('My comment')
|
831 | |
comment = @gen.document['a section'].lines.to_a.first
|
832 | |
- comment.should be_kind_of(IniParse::Lines::Comment)
|
833 | |
- comment.to_ini.should match(/My comment/)
|
834 | |
+ expect(comment).to be_kind_of(IniParse::Lines::Comment)
|
835 | |
+ expect(comment.to_ini).to match(/My comment/)
|
836 | |
end
|
837 | |
end
|
838 | |
end
|
839 | |
@@ -122,14 +122,14 @@ describe 'When generating a document using Generator without section blocks,' do
|
840 | |
it 'should add a blank line to the document when it is the context' do
|
841 | |
@gen.blank
|
842 | |
comment = @gen.document.lines.to_a.first
|
843 | |
- comment.should be_kind_of(IniParse::Lines::Blank)
|
844 | |
+ expect(comment).to be_kind_of(IniParse::Lines::Blank)
|
845 | |
end
|
846 | |
|
847 | |
it 'should add a blank line to the section when it is the context' do
|
848 | |
@gen.section('a section')
|
849 | |
@gen.blank
|
850 | |
comment = @gen.document['a section'].lines.to_a.first
|
851 | |
- comment.should be_kind_of(IniParse::Lines::Blank)
|
852 | |
+ expect(comment).to be_kind_of(IniParse::Lines::Blank)
|
853 | |
end
|
854 | |
end
|
855 | |
|
856 | |
diff --git a/spec/iniparse_spec.rb b/spec/iniparse_spec.rb
|
857 | |
index 0735660..6acebc9 100644
|
858 | |
--- a/spec/iniparse_spec.rb
|
859 | |
+++ b/spec/iniparse_spec.rb
|
860 | |
@@ -45,18 +45,18 @@ describe "IniParse" do
|
861 | |
end
|
862 | |
|
863 | |
describe '.open' do
|
864 | |
- before(:each) { File.stub(:read).and_return('[section]') }
|
865 | |
+ before(:each) { allow(File).to receive(:read).and_return('[section]') }
|
866 | |
|
867 | |
it 'should return an IniParse::Document' do
|
868 | |
- IniParse.open('/my/path.ini').should be_kind_of(IniParse::Document)
|
869 | |
+ expect(IniParse.open('/my/path.ini')).to be_kind_of(IniParse::Document)
|
870 | |
end
|
871 | |
|
872 | |
it 'should set the path on the returned Document' do
|
873 | |
- IniParse.open('/my/path.ini').path.should == '/my/path.ini'
|
874 | |
+ expect(IniParse.open('/my/path.ini').path).to eq('/my/path.ini')
|
875 | |
end
|
876 | |
|
877 | |
it 'should read the file at the given path' do
|
878 | |
- File.should_receive(:read).with('/my/path.ini').and_return('[section]')
|
879 | |
+ expect(File).to receive(:read).with('/my/path.ini').and_return('[section]')
|
880 | |
IniParse.open('/my/path.ini')
|
881 | |
end
|
882 | |
end
|
883 | |
diff --git a/spec/line_collection_spec.rb b/spec/line_collection_spec.rb
|
884 | |
index fa0554c..85a0924 100644
|
885 | |
--- a/spec/line_collection_spec.rb
|
886 | |
+++ b/spec/line_collection_spec.rb
|
887 | |
@@ -4,7 +4,7 @@ require 'spec_helper'
|
888 | |
# Shared specs for all Collection types...
|
889 | |
# ----------------------------------------------------------------------------
|
890 | |
|
891 | |
-share_examples_for "LineCollection" do
|
892 | |
+shared_examples_for "LineCollection" do
|
893 | |
before(:each) do
|
894 | |
@collection << (@c1 = IniParse::Lines::Comment.new)
|
895 | |
@collection << @i1
|
896 | |
@@ -16,7 +16,7 @@ share_examples_for "LineCollection" do
|
897 | |
|
898 | |
describe '#each' do
|
899 | |
it 'should remove blanks and comments by default' do
|
900 | |
- @collection.each { |l| l.should be_kind_of(@i1.class) }
|
901 | |
+ @collection.each { |l| expect(l).to be_kind_of(@i1.class) }
|
902 | |
end
|
903 | |
|
904 | |
it 'should not remove blanks and comments if true is given' do
|
905 | |
@@ -27,121 +27,121 @@ share_examples_for "LineCollection" do
|
906 | |
arr << line
|
907 | |
end
|
908 | |
|
909 | |
- arr.should == [@c1, @i1, @i2, @b1, @i3, @b2]
|
910 | |
+ expect(arr).to eq([@c1, @i1, @i2, @b1, @i3, @b2])
|
911 | |
end
|
912 | |
end
|
913 | |
|
914 | |
describe '#[]' do
|
915 | |
it 'should fetch the correct value' do
|
916 | |
- @collection['first'].should == @i1
|
917 | |
- @collection['second'].should == @i2
|
918 | |
- @collection['third'].should == @i3
|
919 | |
+ expect(@collection['first']).to eq(@i1)
|
920 | |
+ expect(@collection['second']).to eq(@i2)
|
921 | |
+ expect(@collection['third']).to eq(@i3)
|
922 | |
end
|
923 | |
|
924 | |
it 'should return nil if the given key does not exist' do
|
925 | |
- @collection['does not exist'].should be_nil
|
926 | |
+ expect(@collection['does not exist']).to be_nil
|
927 | |
end
|
928 | |
end
|
929 | |
|
930 | |
describe '#[]=' do
|
931 | |
it 'should successfully add a new key' do
|
932 | |
@collection['fourth'] = @new
|
933 | |
- @collection['fourth'].should == @new
|
934 | |
+ expect(@collection['fourth']).to eq(@new)
|
935 | |
end
|
936 | |
|
937 | |
it 'should successfully update an existing key' do
|
938 | |
@collection['second'] = @new
|
939 | |
- @collection['second'].should == @new
|
940 | |
+ expect(@collection['second']).to eq(@new)
|
941 | |
|
942 | |
# Make sure the old data is gone.
|
943 | |
- @collection.detect { |s| s.key == 'second' }.should be_nil
|
944 | |
+ expect(@collection.detect { |s| s.key == 'second' }).to be_nil
|
945 | |
end
|
946 | |
|
947 | |
it 'should typecast given keys to a string' do
|
948 | |
@collection[:a_symbol] = @new
|
949 | |
- @collection['a_symbol'].should == @new
|
950 | |
+ expect(@collection['a_symbol']).to eq(@new)
|
951 | |
end
|
952 | |
end
|
953 | |
|
954 | |
describe '#<<' do
|
955 | |
it 'should set the key correctly if given a new item' do
|
956 | |
- @collection.should_not have_key(@new.key)
|
957 | |
+ expect(@collection).not_to have_key(@new.key)
|
958 | |
@collection << @new
|
959 | |
- @collection.should have_key(@new.key)
|
960 | |
+ expect(@collection).to have_key(@new.key)
|
961 | |
end
|
962 | |
|
963 | |
it 'should append Blank lines' do
|
964 | |
@collection << IniParse::Lines::Blank.new
|
965 | |
- @collection.instance_variable_get(:@lines).last.should \
|
966 | |
+ expect(@collection.instance_variable_get(:@lines).last).to \
|
967 | |
be_kind_of(IniParse::Lines::Blank)
|
968 | |
end
|
969 | |
|
970 | |
it 'should append Comment lines' do
|
971 | |
@collection << IniParse::Lines::Comment.new
|
972 | |
- @collection.instance_variable_get(:@lines).last.should \
|
973 | |
+ expect(@collection.instance_variable_get(:@lines).last).to \
|
974 | |
be_kind_of(IniParse::Lines::Comment)
|
975 | |
end
|
976 | |
|
977 | |
it 'should return self' do
|
978 | |
- (@collection << @new).should == @collection
|
979 | |
+ expect(@collection << @new).to eq(@collection)
|
980 | |
end
|
981 | |
end
|
982 | |
|
983 | |
describe '#delete' do
|
984 | |
it 'should remove the given value and adjust the indicies' do
|
985 | |
- @collection['second'].should_not be_nil
|
986 | |
+ expect(@collection['second']).not_to be_nil
|
987 | |
@collection.delete('second')
|
988 | |
- @collection['second'].should be_nil
|
989 | |
- @collection['first'].should == @i1
|
990 | |
- @collection['third'].should == @i3
|
991 | |
+ expect(@collection['second']).to be_nil
|
992 | |
+ expect(@collection['first']).to eq(@i1)
|
993 | |
+ expect(@collection['third']).to eq(@i3)
|
994 | |
end
|
995 | |
|
996 | |
it "should do nothing if the supplied key does not exist" do
|
997 | |
@collection.delete('does not exist')
|
998 | |
- @collection['first'].should == @i1
|
999 | |
- @collection['third'].should == @i3
|
1000 | |
+ expect(@collection['first']).to eq(@i1)
|
1001 | |
+ expect(@collection['third']).to eq(@i3)
|
1002 | |
end
|
1003 | |
end
|
1004 | |
|
1005 | |
describe '#to_a' do
|
1006 | |
it 'should return an array' do
|
1007 | |
- @collection.to_a.should be_kind_of(Array)
|
1008 | |
+ expect(@collection.to_a).to be_kind_of(Array)
|
1009 | |
end
|
1010 | |
|
1011 | |
it 'should include all lines' do
|
1012 | |
- @collection.to_a.should == [@c1, @i1, @i2, @b1, @i3, @b2]
|
1013 | |
+ expect(@collection.to_a).to eq([@c1, @i1, @i2, @b1, @i3, @b2])
|
1014 | |
end
|
1015 | |
|
1016 | |
it 'should include references to the same line objects as the collection' do
|
1017 | |
@collection << @new
|
1018 | |
- @collection.to_a.last.object_id.should == @new.object_id
|
1019 | |
+ expect(@collection.to_a.last.object_id).to eq(@new.object_id)
|
1020 | |
end
|
1021 | |
end
|
1022 | |
|
1023 | |
describe '#to_hash' do
|
1024 | |
it 'should return a hash' do
|
1025 | |
- @collection.to_hash.should be_kind_of(Hash)
|
1026 | |
+ expect(@collection.to_hash).to be_kind_of(Hash)
|
1027 | |
end
|
1028 | |
|
1029 | |
it 'should have the correct keys' do
|
1030 | |
hash = @collection.to_hash
|
1031 | |
- hash.keys.length.should == 3
|
1032 | |
- hash.should have_key('first')
|
1033 | |
- hash.should have_key('second')
|
1034 | |
- hash.should have_key('third')
|
1035 | |
+ expect(hash.keys.length).to eq(3)
|
1036 | |
+ expect(hash).to have_key('first')
|
1037 | |
+ expect(hash).to have_key('second')
|
1038 | |
+ expect(hash).to have_key('third')
|
1039 | |
end
|
1040 | |
|
1041 | |
it 'should have the correct values' do
|
1042 | |
hash = @collection.to_hash
|
1043 | |
- hash['first'].should == @i1
|
1044 | |
- hash['second'].should == @i2
|
1045 | |
- hash['third'].should == @i3
|
1046 | |
+ expect(hash['first']).to eq(@i1)
|
1047 | |
+ expect(hash['second']).to eq(@i2)
|
1048 | |
+ expect(hash['third']).to eq(@i3)
|
1049 | |
end
|
1050 | |
end
|
1051 | |
|
1052 | |
describe '#keys' do
|
1053 | |
it 'should return an array of strings' do
|
1054 | |
- @collection.keys.should == ['first', 'second', 'third']
|
1055 | |
+ expect(@collection.keys).to eq(['first', 'second', 'third'])
|
1056 | |
end
|
1057 | |
end
|
1058 | |
end
|
1059 | |
@@ -163,7 +163,7 @@ describe 'IniParse::OptionCollection' do
|
1060 | |
|
1061 | |
describe '#<<' do
|
1062 | |
it 'should raise a LineNotAllowed exception if a Section is pushed' do
|
1063 | |
- lambda { @collection << IniParse::Lines::Section.new('s') }.should \
|
1064 | |
+ expect { @collection << IniParse::Lines::Section.new('s') }.to \
|
1065 | |
raise_error(IniParse::LineNotAllowed)
|
1066 | |
end
|
1067 | |
|
1068 | |
@@ -174,7 +174,7 @@ describe 'IniParse::OptionCollection' do
|
1069 | |
@collection << option_one
|
1070 | |
@collection << option_two
|
1071 | |
|
1072 | |
- @collection['k'].should == [option_one, option_two]
|
1073 | |
+ expect(@collection['k']).to eq([option_one, option_two])
|
1074 | |
end
|
1075 | |
end
|
1076 | |
|
1077 | |
@@ -182,7 +182,7 @@ describe 'IniParse::OptionCollection' do
|
1078 | |
it 'should handle duplicates' do
|
1079 | |
@collection << @i1 << @i2 << @i3
|
1080 | |
@collection << IniParse::Lines::Option.new('first', 'v5')
|
1081 | |
- @collection.keys.should == ['first', 'second', 'third']
|
1082 | |
+ expect(@collection.keys).to eq(['first', 'second', 'third'])
|
1083 | |
end
|
1084 | |
end
|
1085 | |
end
|
1086 | |
@@ -202,7 +202,7 @@ describe 'IniParse::SectionCollection' do
|
1087 | |
it 'should add merge Section with the other, if it is a duplicate' do
|
1088 | |
new_section = IniParse::Lines::Section.new('first')
|
1089 | |
@collection << @i1
|
1090 | |
- @i1.should_receive(:merge!).with(new_section).once
|
1091 | |
+ expect(@i1).to receive(:merge!).with(new_section).once
|
1092 | |
@collection << new_section
|
1093 | |
end
|
1094 | |
end
|
1095 | |
diff --git a/spec/lines_spec.rb b/spec/lines_spec.rb
|
1096 | |
index ec64945..c34a8cf 100644
|
1097 | |
--- a/spec/lines_spec.rb
|
1098 | |
+++ b/spec/lines_spec.rb
|
1099 | |
@@ -13,44 +13,44 @@ end
|
1100 | |
describe "IniParse::Lines::Line module" do
|
1101 | |
describe '#to_ini' do
|
1102 | |
it 'should return +line_contents+' do
|
1103 | |
- IniParse::Test::FakeLine.new.to_ini.should == 'fake line'
|
1104 | |
+ expect(IniParse::Test::FakeLine.new.to_ini).to eq('fake line')
|
1105 | |
end
|
1106 | |
|
1107 | |
it 'should preserve line indents' do
|
1108 | |
- IniParse::Test::FakeLine.new(
|
1109 | |
+ expect(IniParse::Test::FakeLine.new(
|
1110 | |
:indent => ' '
|
1111 | |
- ).to_ini.should == ' fake line'
|
1112 | |
+ ).to_ini).to eq(' fake line')
|
1113 | |
end
|
1114 | |
|
1115 | |
describe 'when a comment is set' do
|
1116 | |
it 'should correctly include the comment' do
|
1117 | |
- IniParse::Test::FakeLine.new(
|
1118 | |
+ expect(IniParse::Test::FakeLine.new(
|
1119 | |
:comment => 'comment', :comment_sep => ';', :comment_offset => 10
|
1120 | |
- ).to_ini.should == 'fake line ; comment'
|
1121 | |
+ ).to_ini).to eq('fake line ; comment')
|
1122 | |
end
|
1123 | |
|
1124 | |
it 'should correctly indent the comment' do
|
1125 | |
- IniParse::Test::FakeLine.new(
|
1126 | |
+ expect(IniParse::Test::FakeLine.new(
|
1127 | |
:comment => 'comment', :comment_sep => ';', :comment_offset => 15
|
1128 | |
- ).to_ini.should == 'fake line ; comment'
|
1129 | |
+ ).to_ini).to eq('fake line ; comment')
|
1130 | |
end
|
1131 | |
|
1132 | |
it 'should use ";" as a default comment seperator' do
|
1133 | |
- IniParse::Test::FakeLine.new(
|
1134 | |
+ expect(IniParse::Test::FakeLine.new(
|
1135 | |
:comment => 'comment'
|
1136 | |
- ).to_ini.should == 'fake line ; comment'
|
1137 | |
+ ).to_ini).to eq('fake line ; comment')
|
1138 | |
end
|
1139 | |
|
1140 | |
it 'should use the correct seperator' do
|
1141 | |
- IniParse::Test::FakeLine.new(
|
1142 | |
+ expect(IniParse::Test::FakeLine.new(
|
1143 | |
:comment => 'comment', :comment_sep => '#'
|
1144 | |
- ).to_ini.should == 'fake line # comment'
|
1145 | |
+ ).to_ini).to eq('fake line # comment')
|
1146 | |
end
|
1147 | |
|
1148 | |
it 'should use the ensure a space is added before the comment seperator' do
|
1149 | |
- IniParse::Test::FakeLine.new(
|
1150 | |
+ expect(IniParse::Test::FakeLine.new(
|
1151 | |
:comment => 'comment', :comment_sep => ';', :comment_offset => 0
|
1152 | |
- ).to_ini.should == 'fake line ; comment'
|
1153 | |
+ ).to_ini).to eq('fake line ; comment')
|
1154 | |
end
|
1155 | |
|
1156 | |
it 'should not add an extra space if the line is blank' do
|
1157 | |
@@ -58,34 +58,34 @@ describe "IniParse::Lines::Line module" do
|
1158 | |
:comment => 'comment', :comment_sep => ';', :comment_offset => 0
|
1159 | |
)
|
1160 | |
|
1161 | |
- line.stub(:line_contents).and_return('')
|
1162 | |
- line.to_ini.should == '; comment'
|
1163 | |
+ allow(line).to receive(:line_contents).and_return('')
|
1164 | |
+ expect(line.to_ini).to eq('; comment')
|
1165 | |
end
|
1166 | |
end
|
1167 | |
|
1168 | |
describe 'when no comment is set' do
|
1169 | |
it 'should not add trailing space if :comment_offset has a value' do
|
1170 | |
- IniParse::Test::FakeLine.new(:comment_offset => 10).to_ini.should == 'fake line'
|
1171 | |
+ expect(IniParse::Test::FakeLine.new(:comment_offset => 10).to_ini).to eq('fake line')
|
1172 | |
end
|
1173 | |
|
1174 | |
it 'should not add a comment seperator :comment_sep has a value' do
|
1175 | |
- IniParse::Test::FakeLine.new(:comment_sep => ';').to_ini.should == 'fake line'
|
1176 | |
+ expect(IniParse::Test::FakeLine.new(:comment_sep => ';').to_ini).to eq('fake line')
|
1177 | |
end
|
1178 | |
end
|
1179 | |
end
|
1180 | |
|
1181 | |
describe '#has_comment?' do
|
1182 | |
it 'should return true if :comment has a non-blank value' do
|
1183 | |
- IniParse::Test::FakeLine.new(:comment => 'comment').should have_comment
|
1184 | |
+ expect(IniParse::Test::FakeLine.new(:comment => 'comment')).to have_comment
|
1185 | |
end
|
1186 | |
|
1187 | |
it 'should return true if :comment has a blank value' do
|
1188 | |
- IniParse::Test::FakeLine.new(:comment => '').should have_comment
|
1189 | |
+ expect(IniParse::Test::FakeLine.new(:comment => '')).to have_comment
|
1190 | |
end
|
1191 | |
|
1192 | |
it 'should return false if :comment has a nil value' do
|
1193 | |
- IniParse::Test::FakeLine.new.should_not have_comment
|
1194 | |
- IniParse::Test::FakeLine.new(:comment => nil).should_not have_comment
|
1195 | |
+ expect(IniParse::Test::FakeLine.new).not_to have_comment
|
1196 | |
+ expect(IniParse::Test::FakeLine.new(:comment => nil)).not_to have_comment
|
1197 | |
end
|
1198 | |
end
|
1199 | |
end
|
1200 | |
@@ -98,20 +98,20 @@ describe 'IniParse::Lines::Section' do
|
1201 | |
before(:each) { @section = IniParse::Lines::Section.new('a section') }
|
1202 | |
|
1203 | |
it 'should respond_to +lines+' do
|
1204 | |
- @section.should respond_to(:lines)
|
1205 | |
+ expect(@section).to respond_to(:lines)
|
1206 | |
end
|
1207 | |
|
1208 | |
it 'should not respond_to +lines=+' do
|
1209 | |
- @section.should_not respond_to(:lines=)
|
1210 | |
+ expect(@section).not_to respond_to(:lines=)
|
1211 | |
end
|
1212 | |
|
1213 | |
it 'should include Enumerable' do
|
1214 | |
- IniParse::Lines::Section.included_modules.should include(Enumerable)
|
1215 | |
+ expect(IniParse::Lines::Section.included_modules).to include(Enumerable)
|
1216 | |
end
|
1217 | |
|
1218 | |
describe '#initialize' do
|
1219 | |
it 'should typecast the given key to a string' do
|
1220 | |
- IniParse::Lines::Section.new(:symbol).key.should == 'symbol'
|
1221 | |
+ expect(IniParse::Lines::Section.new(:symbol).key).to eq('symbol')
|
1222 | |
end
|
1223 | |
end
|
1224 | |
|
1225 | |
@@ -119,68 +119,68 @@ describe 'IniParse::Lines::Section' do
|
1226 | |
it 'should retrieve the line identified by the given key' do
|
1227 | |
option = IniParse::Lines::Option.new('k', 'value one')
|
1228 | |
@section.lines << option
|
1229 | |
- @section.option('k').should == option
|
1230 | |
+ expect(@section.option('k')).to eq(option)
|
1231 | |
end
|
1232 | |
|
1233 | |
it 'should return nil if the given key does not exist' do
|
1234 | |
- @section.option('does_not_exist').should be_nil
|
1235 | |
+ expect(@section.option('does_not_exist')).to be_nil
|
1236 | |
end
|
1237 | |
end
|
1238 | |
|
1239 | |
describe '#each' do
|
1240 | |
it 'should call #each on +lines+' do
|
1241 | |
- @section.lines.should_receive(:each)
|
1242 | |
+ expect(@section.lines).to receive(:each)
|
1243 | |
@section.each { |l| }
|
1244 | |
end
|
1245 | |
end
|
1246 | |
|
1247 | |
describe '#[]' do
|
1248 | |
it 'should return nil if the given key does not exist' do
|
1249 | |
- @section['k'].should be_nil
|
1250 | |
+ expect(@section['k']).to be_nil
|
1251 | |
end
|
1252 | |
|
1253 | |
it 'should return a value if the given key exists' do
|
1254 | |
@section.lines << IniParse::Lines::Option.new('k', 'v')
|
1255 | |
- @section['k'].should == 'v'
|
1256 | |
+ expect(@section['k']).to eq('v')
|
1257 | |
end
|
1258 | |
|
1259 | |
it 'should return an array of values if the key is a duplicate' do
|
1260 | |
@section.lines << IniParse::Lines::Option.new('k', 'v1')
|
1261 | |
@section.lines << IniParse::Lines::Option.new('k', 'v2')
|
1262 | |
@section.lines << IniParse::Lines::Option.new('k', 'v3')
|
1263 | |
- @section['k'].should == ['v1', 'v2', 'v3']
|
1264 | |
+ expect(@section['k']).to eq(['v1', 'v2', 'v3'])
|
1265 | |
end
|
1266 | |
|
1267 | |
it 'should typecast the key to a string' do
|
1268 | |
@section.lines << IniParse::Lines::Option.new('k', 'v')
|
1269 | |
- @section[:k].should == 'v'
|
1270 | |
+ expect(@section[:k]).to eq('v')
|
1271 | |
end
|
1272 | |
end
|
1273 | |
|
1274 | |
describe '#[]=' do
|
1275 | |
it 'should add a new Option with the given key and value' do
|
1276 | |
@section['k'] = 'a value'
|
1277 | |
- @section.option('k').should be_kind_of(IniParse::Lines::Option)
|
1278 | |
- @section['k'].should == 'a value'
|
1279 | |
+ expect(@section.option('k')).to be_kind_of(IniParse::Lines::Option)
|
1280 | |
+ expect(@section['k']).to eq('a value')
|
1281 | |
end
|
1282 | |
|
1283 | |
it 'should update the Option if one already exists' do
|
1284 | |
@section.lines << IniParse::Lines::Option.new('k', 'orig value')
|
1285 | |
@section['k'] = 'new value'
|
1286 | |
- @section['k'].should == 'new value'
|
1287 | |
+ expect(@section['k']).to eq('new value')
|
1288 | |
end
|
1289 | |
|
1290 | |
it 'should replace the existing Option if it is an array' do
|
1291 | |
@section.lines << IniParse::Lines::Option.new('k', 'v1')
|
1292 | |
@section.lines << IniParse::Lines::Option.new('k', 'v2')
|
1293 | |
@section['k'] = 'new value'
|
1294 | |
- @section.option('k').should be_kind_of(IniParse::Lines::Option)
|
1295 | |
- @section['k'].should == 'new value'
|
1296 | |
+ expect(@section.option('k')).to be_kind_of(IniParse::Lines::Option)
|
1297 | |
+ expect(@section['k']).to eq('new value')
|
1298 | |
end
|
1299 | |
|
1300 | |
it 'should typecast the key to a string' do
|
1301 | |
@section[:k] = 'a value'
|
1302 | |
- @section['k'].should == 'a value'
|
1303 | |
+ expect(@section['k']).to eq('a value')
|
1304 | |
end
|
1305 | |
end
|
1306 | |
|
1307 | |
@@ -199,16 +199,16 @@ describe 'IniParse::Lines::Section' do
|
1308 | |
@new_section.lines << IniParse::Lines::Option.new('d', 'val4')
|
1309 | |
|
1310 | |
@section.merge!(@new_section)
|
1311 | |
- @section['a'].should == 'val1'
|
1312 | |
- @section['b'].should == 'val2'
|
1313 | |
- @section['c'].should == 'val3'
|
1314 | |
- @section['d'].should == 'val4'
|
1315 | |
+ expect(@section['a']).to eq('val1')
|
1316 | |
+ expect(@section['b']).to eq('val2')
|
1317 | |
+ expect(@section['c']).to eq('val3')
|
1318 | |
+ expect(@section['d']).to eq('val4')
|
1319 | |
end
|
1320 | |
|
1321 | |
it 'should handle duplicates' do
|
1322 | |
@new_section.lines << IniParse::Lines::Option.new('a', 'val2')
|
1323 | |
@section.merge!(@new_section)
|
1324 | |
- @section['a'].should == ['val1', 'val2']
|
1325 | |
+ expect(@section['a']).to eq(['val1', 'val2'])
|
1326 | |
end
|
1327 | |
|
1328 | |
it 'should handle duplicates on both sides' do
|
1329 | |
@@ -217,7 +217,7 @@ describe 'IniParse::Lines::Section' do
|
1330 | |
@new_section.lines << IniParse::Lines::Option.new('a', 'val4')
|
1331 | |
|
1332 | |
@section.merge!(@new_section)
|
1333 | |
- @section['a'].should == ['val1', 'val2', 'val3', 'val4']
|
1334 | |
+ expect(@section['a']).to eq(['val1', 'val2', 'val3', 'val4'])
|
1335 | |
end
|
1336 | |
|
1337 | |
it 'should copy blank lines' do
|
1338 | |
@@ -225,7 +225,7 @@ describe 'IniParse::Lines::Section' do
|
1339 | |
@section.merge!(@new_section)
|
1340 | |
line = nil
|
1341 | |
@section.each(true) { |l| line = l }
|
1342 | |
- line.should be_kind_of(IniParse::Lines::Blank)
|
1343 | |
+ expect(line).to be_kind_of(IniParse::Lines::Blank)
|
1344 | |
end
|
1345 | |
|
1346 | |
it 'should copy comments' do
|
1347 | |
@@ -233,7 +233,7 @@ describe 'IniParse::Lines::Section' do
|
1348 | |
@section.merge!(@new_section)
|
1349 | |
line = nil
|
1350 | |
@section.each(true) { |l| line = l }
|
1351 | |
- line.should be_kind_of(IniParse::Lines::Comment)
|
1352 | |
+ expect(line).to be_kind_of(IniParse::Lines::Comment)
|
1353 | |
end
|
1354 | |
end
|
1355 | |
|
1356 | |
@@ -247,27 +247,27 @@ describe 'IniParse::Lines::Section' do
|
1357 | |
end
|
1358 | |
|
1359 | |
it 'removes the option given a key' do
|
1360 | |
- lambda { @section.delete('a') }.
|
1361 | |
- should change { @section['a'] }.to(nil)
|
1362 | |
+ expect { @section.delete('a') }.
|
1363 | |
+ to change { @section['a'] }.to(nil)
|
1364 | |
end
|
1365 | |
|
1366 | |
it 'removes the option given an Option' do
|
1367 | |
- lambda { @section.delete(opt_one) }.
|
1368 | |
- should change { @section['a'] }.to(nil)
|
1369 | |
+ expect { @section.delete(opt_one) }.
|
1370 | |
+ to change { @section['a'] }.to(nil)
|
1371 | |
end
|
1372 | |
|
1373 | |
it 'should not remove non-matching lines' do
|
1374 | |
- lambda { @section.delete('a') }.should_not change { @section['c'] }
|
1375 | |
+ expect { @section.delete('a') }.not_to change { @section['c'] }
|
1376 | |
end
|
1377 | |
|
1378 | |
it 'returns the section' do
|
1379 | |
- @section.delete('a').should eql(@section)
|
1380 | |
+ expect(@section.delete('a')).to eql(@section)
|
1381 | |
end
|
1382 | |
end
|
1383 | |
|
1384 | |
describe '#to_ini' do
|
1385 | |
it 'should include the section key' do
|
1386 | |
- IniParse::Lines::Section.new('a section').to_ini.should == '[a section]'
|
1387 | |
+ expect(IniParse::Lines::Section.new('a section').to_ini).to eq('[a section]')
|
1388 | |
end
|
1389 | |
|
1390 | |
it 'should include lines belonging to the section' do
|
1391 | |
@@ -278,22 +278,24 @@ describe 'IniParse::Lines::Section' do
|
1392 | |
)
|
1393 | |
@section.lines << IniParse::Lines::Option.new('b', 'val2')
|
1394 | |
|
1395 | |
- @section.to_ini.should ==
|
1396 | |
+ expect(@section.to_ini).to eq(
|
1397 | |
"[a section]\n" \
|
1398 | |
"a = val1\n" \
|
1399 | |
"\n" \
|
1400 | |
"; my comment\n" \
|
1401 | |
"b = val2"
|
1402 | |
+ )
|
1403 | |
end
|
1404 | |
|
1405 | |
it 'should include duplicate lines' do
|
1406 | |
@section.lines << IniParse::Lines::Option.new('a', 'val1')
|
1407 | |
@section.lines << IniParse::Lines::Option.new('a', 'val2')
|
1408 | |
|
1409 | |
- @section.to_ini.should ==
|
1410 | |
+ expect(@section.to_ini).to eq(
|
1411 | |
"[a section]\n" \
|
1412 | |
"a = val1\n" \
|
1413 | |
"a = val2"
|
1414 | |
+ )
|
1415 | |
end
|
1416 | |
end
|
1417 | |
|
1418 | |
@@ -303,11 +305,11 @@ describe 'IniParse::Lines::Section' do
|
1419 | |
end
|
1420 | |
|
1421 | |
it 'should return true if an option with the given key exists' do
|
1422 | |
- @section.should have_option('first')
|
1423 | |
+ expect(@section).to have_option('first')
|
1424 | |
end
|
1425 | |
|
1426 | |
it 'should return true if no option with the given key exists' do
|
1427 | |
- @section.should_not have_option('second')
|
1428 | |
+ expect(@section).not_to have_option('second')
|
1429 | |
end
|
1430 | |
end
|
1431 | |
end
|
1432 | |
@@ -319,13 +321,13 @@ end
|
1433 | |
describe 'Iniparse::Lines::Option' do
|
1434 | |
describe '#initialize' do
|
1435 | |
it 'should typecast the given key to a string' do
|
1436 | |
- IniParse::Lines::Option.new(:symbol, '').key.should == 'symbol'
|
1437 | |
+ expect(IniParse::Lines::Option.new(:symbol, '').key).to eq('symbol')
|
1438 | |
end
|
1439 | |
end
|
1440 | |
|
1441 | |
describe '#to_ini' do
|
1442 | |
it 'should include the key and value' do
|
1443 | |
- IniParse::Lines::Option.new('key', 'value').to_ini.should == 'key = value'
|
1444 | |
+ expect(IniParse::Lines::Option.new('key', 'value').to_ini).to eq('key = value')
|
1445 | |
end
|
1446 | |
end
|
1447 | |
|
1448 | |
@@ -335,70 +337,70 @@ describe 'Iniparse::Lines::Option' do
|
1449 | |
end
|
1450 | |
|
1451 | |
it 'should typecast empty values to nil' do
|
1452 | |
- parse('key =').should be_option_tuple('key', nil)
|
1453 | |
- parse('key = ').should be_option_tuple('key', nil)
|
1454 | |
- parse('key = ').should be_option_tuple('key', nil)
|
1455 | |
+ expect(parse('key =')).to be_option_tuple('key', nil)
|
1456 | |
+ expect(parse('key = ')).to be_option_tuple('key', nil)
|
1457 | |
+ expect(parse('key = ')).to be_option_tuple('key', nil)
|
1458 | |
end
|
1459 | |
|
1460 | |
it 'should not typecast "true" if true is part of a word' do
|
1461 | |
- parse('key = TestTrueTest').should be_option_tuple('key', 'TestTrueTest')
|
1462 | |
- parse('key = TrueTest').should be_option_tuple('key', 'TrueTest')
|
1463 | |
- parse('key = TestTrue').should be_option_tuple('key', 'TestTrue')
|
1464 | |
+ expect(parse('key = TestTrueTest')).to be_option_tuple('key', 'TestTrueTest')
|
1465 | |
+ expect(parse('key = TrueTest')).to be_option_tuple('key', 'TrueTest')
|
1466 | |
+ expect(parse('key = TestTrue')).to be_option_tuple('key', 'TestTrue')
|
1467 | |
end
|
1468 | |
|
1469 | |
it 'should not typecast "false" if false is part of a word' do
|
1470 | |
- parse('key = TestFalseTest').should be_option_tuple('key', 'TestFalseTest')
|
1471 | |
- parse('key = FalseTest').should be_option_tuple('key', 'FalseTest')
|
1472 | |
- parse('key = TestFalse').should be_option_tuple('key', 'TestFalse')
|
1473 | |
+ expect(parse('key = TestFalseTest')).to be_option_tuple('key', 'TestFalseTest')
|
1474 | |
+ expect(parse('key = FalseTest')).to be_option_tuple('key', 'FalseTest')
|
1475 | |
+ expect(parse('key = TestFalse')).to be_option_tuple('key', 'TestFalse')
|
1476 | |
end
|
1477 | |
|
1478 | |
it 'should typecast "true" to TrueClass' do
|
1479 | |
- parse('key = true').should be_option_tuple('key', true)
|
1480 | |
- parse('key = TRUE').should be_option_tuple('key', true)
|
1481 | |
+ expect(parse('key = true')).to be_option_tuple('key', true)
|
1482 | |
+ expect(parse('key = TRUE')).to be_option_tuple('key', true)
|
1483 | |
end
|
1484 | |
|
1485 | |
it 'should typecast "false" to FalseClass' do
|
1486 | |
- parse('key = false').should be_option_tuple('key', false)
|
1487 | |
- parse('key = FALSE').should be_option_tuple('key', false)
|
1488 | |
+ expect(parse('key = false')).to be_option_tuple('key', false)
|
1489 | |
+ expect(parse('key = FALSE')).to be_option_tuple('key', false)
|
1490 | |
end
|
1491 | |
|
1492 | |
it 'should typecast integer values to Integer' do
|
1493 | |
- parse('key = 1').should be_option_tuple('key', 1)
|
1494 | |
- parse('key = 10').should be_option_tuple('key', 10)
|
1495 | |
+ expect(parse('key = 1')).to be_option_tuple('key', 1)
|
1496 | |
+ expect(parse('key = 10')).to be_option_tuple('key', 10)
|
1497 | |
end
|
1498 | |
|
1499 | |
it 'should not typecast integers with a leading 0 to Integer' do
|
1500 | |
- parse('key = 0700').should be_option_tuple('key', '0700')
|
1501 | |
+ expect(parse('key = 0700')).to be_option_tuple('key', '0700')
|
1502 | |
end
|
1503 | |
|
1504 | |
it 'should typecast negative integer values to Integer' do
|
1505 | |
- parse('key = -1').should be_option_tuple('key', -1)
|
1506 | |
+ expect(parse('key = -1')).to be_option_tuple('key', -1)
|
1507 | |
end
|
1508 | |
|
1509 | |
it 'should typecast float values to Float' do
|
1510 | |
- parse('key = 3.14159265').should be_option_tuple('key', 3.14159265)
|
1511 | |
+ expect(parse('key = 3.14159265')).to be_option_tuple('key', 3.14159265)
|
1512 | |
end
|
1513 | |
|
1514 | |
it 'should typecast negative float values to Float' do
|
1515 | |
- parse('key = -3.14159265').should be_option_tuple('key', -3.14159265)
|
1516 | |
+ expect(parse('key = -3.14159265')).to be_option_tuple('key', -3.14159265)
|
1517 | |
end
|
1518 | |
|
1519 | |
it 'should typecast scientific notation numbers to Float' do
|
1520 | |
- parse('key = 10e5').should be_option_tuple('key', 10e5)
|
1521 | |
- parse('key = 10e+5').should be_option_tuple('key', 10e5)
|
1522 | |
- parse('key = 10e-5').should be_option_tuple('key', 10e-5)
|
1523 | |
+ expect(parse('key = 10e5')).to be_option_tuple('key', 10e5)
|
1524 | |
+ expect(parse('key = 10e+5')).to be_option_tuple('key', 10e5)
|
1525 | |
+ expect(parse('key = 10e-5')).to be_option_tuple('key', 10e-5)
|
1526 | |
|
1527 | |
- parse('key = -10e5').should be_option_tuple('key', -10e5)
|
1528 | |
- parse('key = -10e+5').should be_option_tuple('key', -10e5)
|
1529 | |
- parse('key = -10e-5').should be_option_tuple('key', -10e-5)
|
1530 | |
+ expect(parse('key = -10e5')).to be_option_tuple('key', -10e5)
|
1531 | |
+ expect(parse('key = -10e+5')).to be_option_tuple('key', -10e5)
|
1532 | |
+ expect(parse('key = -10e-5')).to be_option_tuple('key', -10e-5)
|
1533 | |
|
1534 | |
- parse('key = 3.14159265e5').should be_option_tuple('key', 3.14159265e5)
|
1535 | |
- parse('key = 3.14159265e+5').should be_option_tuple('key', 3.14159265e5)
|
1536 | |
- parse('key = 3.14159265e-5').should be_option_tuple('key', 3.14159265e-5)
|
1537 | |
+ expect(parse('key = 3.14159265e5')).to be_option_tuple('key', 3.14159265e5)
|
1538 | |
+ expect(parse('key = 3.14159265e+5')).to be_option_tuple('key', 3.14159265e5)
|
1539 | |
+ expect(parse('key = 3.14159265e-5')).to be_option_tuple('key', 3.14159265e-5)
|
1540 | |
|
1541 | |
- parse('key = -3.14159265e5').should be_option_tuple('key', -3.14159265e5)
|
1542 | |
- parse('key = -3.14159265e+5').should be_option_tuple('key', -3.14159265e5)
|
1543 | |
- parse('key = -3.14159265e-5').should be_option_tuple('key', -3.14159265e-5)
|
1544 | |
+ expect(parse('key = -3.14159265e5')).to be_option_tuple('key', -3.14159265e5)
|
1545 | |
+ expect(parse('key = -3.14159265e+5')).to be_option_tuple('key', -3.14159265e5)
|
1546 | |
+ expect(parse('key = -3.14159265e-5')).to be_option_tuple('key', -3.14159265e-5)
|
1547 | |
end
|
1548 | |
end
|
1549 | |
end
|
1550 | |
@@ -414,34 +416,34 @@ end
|
1551 | |
describe 'IniParse::Lines::Comment' do
|
1552 | |
describe '#has_comment?' do
|
1553 | |
it 'should return true if :comment has a non-blank value' do
|
1554 | |
- IniParse::Lines::Comment.new(:comment => 'comment').should have_comment
|
1555 | |
+ expect(IniParse::Lines::Comment.new(:comment => 'comment')).to have_comment
|
1556 | |
end
|
1557 | |
|
1558 | |
it 'should return true if :comment has a blank value' do
|
1559 | |
- IniParse::Lines::Comment.new(:comment => '').should have_comment
|
1560 | |
+ expect(IniParse::Lines::Comment.new(:comment => '')).to have_comment
|
1561 | |
end
|
1562 | |
|
1563 | |
it 'should return true if :comment has a nil value' do
|
1564 | |
- IniParse::Lines::Comment.new.should have_comment
|
1565 | |
- IniParse::Lines::Comment.new(:comment => nil).should have_comment
|
1566 | |
+ expect(IniParse::Lines::Comment.new).to have_comment
|
1567 | |
+ expect(IniParse::Lines::Comment.new(:comment => nil)).to have_comment
|
1568 | |
end
|
1569 | |
end
|
1570 | |
|
1571 | |
describe '#to_ini' do
|
1572 | |
it 'should return the comment' do
|
1573 | |
- IniParse::Lines::Comment.new(
|
1574 | |
+ expect(IniParse::Lines::Comment.new(
|
1575 | |
:comment => 'a comment'
|
1576 | |
- ).to_ini.should == '; a comment'
|
1577 | |
+ ).to_ini).to eq('; a comment')
|
1578 | |
end
|
1579 | |
|
1580 | |
it 'should preserve comment offset' do
|
1581 | |
- IniParse::Lines::Comment.new(
|
1582 | |
+ expect(IniParse::Lines::Comment.new(
|
1583 | |
:comment => 'a comment', :comment_offset => 10
|
1584 | |
- ).to_ini.should == ' ; a comment'
|
1585 | |
+ ).to_ini).to eq(' ; a comment')
|
1586 | |
end
|
1587 | |
|
1588 | |
it 'should return just the comment_sep if the comment is blank' do
|
1589 | |
- IniParse::Lines::Comment.new.to_ini.should == ';'
|
1590 | |
+ expect(IniParse::Lines::Comment.new.to_ini).to eq(';')
|
1591 | |
end
|
1592 | |
end
|
1593 | |
end
|
1594 | |
diff --git a/spec/parser/document_parsing_spec.rb b/spec/parser/document_parsing_spec.rb
|
1595 | |
index 4636aae..c882542 100644
|
1596 | |
--- a/spec/parser/document_parsing_spec.rb
|
1597 | |
+++ b/spec/parser/document_parsing_spec.rb
|
1598 | |
@@ -9,53 +9,53 @@ describe 'Parsing a document' do
|
1599 | |
end
|
1600 | |
|
1601 | |
it 'should have a comment as the first line' do
|
1602 | |
- @doc.lines.to_a.first.should be_kind_of(IniParse::Lines::Comment)
|
1603 | |
+ expect(@doc.lines.to_a.first).to be_kind_of(IniParse::Lines::Comment)
|
1604 | |
end
|
1605 | |
|
1606 | |
it 'should have one section' do
|
1607 | |
- @doc.lines.keys.should == ['first_section']
|
1608 | |
+ expect(@doc.lines.keys).to eq(['first_section'])
|
1609 | |
end
|
1610 | |
|
1611 | |
it 'should have one option belonging to `first_section`' do
|
1612 | |
- @doc['first_section']['key'].should == 'value'
|
1613 | |
+ expect(@doc['first_section']['key']).to eq('value')
|
1614 | |
end
|
1615 | |
end
|
1616 | |
|
1617 | |
it 'should allow blank lines to preceed the first section' do
|
1618 | |
- lambda {
|
1619 | |
+ expect {
|
1620 | |
@doc = IniParse::Parser.new(fixture(:blank_before_section)).parse
|
1621 | |
- }.should_not raise_error
|
1622 | |
+ }.not_to raise_error
|
1623 | |
|
1624 | |
- @doc.lines.to_a.first.should be_kind_of(IniParse::Lines::Blank)
|
1625 | |
+ expect(@doc.lines.to_a.first).to be_kind_of(IniParse::Lines::Blank)
|
1626 | |
end
|
1627 | |
|
1628 | |
it 'should allow a blank line to belong to a section' do
|
1629 | |
- lambda {
|
1630 | |
+ expect {
|
1631 | |
@doc = IniParse::Parser.new(fixture(:blank_in_section)).parse
|
1632 | |
- }.should_not raise_error
|
1633 | |
+ }.not_to raise_error
|
1634 | |
|
1635 | |
- @doc['first_section'].lines.to_a.first.should be_kind_of(IniParse::Lines::Blank)
|
1636 | |
+ expect(@doc['first_section'].lines.to_a.first).to be_kind_of(IniParse::Lines::Blank)
|
1637 | |
end
|
1638 | |
|
1639 | |
it 'should permit comments on their own line' do
|
1640 | |
- lambda {
|
1641 | |
+ expect {
|
1642 | |
@doc = IniParse::Parser.new(fixture(:comment_line)).parse
|
1643 | |
- }.should_not raise_error
|
1644 | |
+ }.not_to raise_error
|
1645 | |
|
1646 | |
line = @doc['first_section'].lines.to_a.first
|
1647 | |
- line.comment.should eql('; block comment ;')
|
1648 | |
+ expect(line.comment).to eql('; block comment ;')
|
1649 | |
end
|
1650 | |
|
1651 | |
it 'should permit options before the first section' do
|
1652 | |
doc = IniParse::Parser.new(fixture(:option_before_section)).parse
|
1653 | |
|
1654 | |
- doc.lines.should have_key('__anonymous__')
|
1655 | |
- doc['__anonymous__']['foo'].should eql('bar')
|
1656 | |
- doc['foo']['another'].should eql('thing')
|
1657 | |
+ expect(doc.lines).to have_key('__anonymous__')
|
1658 | |
+ expect(doc['__anonymous__']['foo']).to eql('bar')
|
1659 | |
+ expect(doc['foo']['another']).to eql('thing')
|
1660 | |
end
|
1661 | |
|
1662 | |
it 'should raise ParseError if a line could not be parsed' do
|
1663 | |
- lambda { IniParse::Parser.new(fixture(:invalid_line)).parse }.should \
|
1664 | |
+ expect { IniParse::Parser.new(fixture(:invalid_line)).parse }.to \
|
1665 | |
raise_error(IniParse::ParseError)
|
1666 | |
end
|
1667 | |
|
1668 | |
@@ -65,20 +65,20 @@ describe 'Parsing a document' do
|
1669 | |
end
|
1670 | |
|
1671 | |
it 'should have two sections' do
|
1672 | |
- @doc.lines.to_a.length.should == 2
|
1673 | |
+ expect(@doc.lines.to_a.length).to eq(2)
|
1674 | |
end
|
1675 | |
|
1676 | |
it 'should have one section' do
|
1677 | |
- @doc.lines.keys.should == ['first_section = name',
|
1678 | |
- 'another_section = a name']
|
1679 | |
+ expect(@doc.lines.keys).to eq(['first_section = name',
|
1680 | |
+ 'another_section = a name'])
|
1681 | |
end
|
1682 | |
|
1683 | |
it 'should have one option belonging to `first_section = name`' do
|
1684 | |
- @doc['first_section = name']['key'].should == 'value'
|
1685 | |
+ expect(@doc['first_section = name']['key']).to eq('value')
|
1686 | |
end
|
1687 | |
|
1688 | |
it 'should have one option belonging to `another_section = a name`' do
|
1689 | |
- @doc['another_section = a name']['another'].should == 'thing'
|
1690 | |
+ expect(@doc['another_section = a name']['another']).to eq('thing')
|
1691 | |
end
|
1692 | |
end
|
1693 | |
|
1694 | |
@@ -89,19 +89,19 @@ describe 'Parsing a document' do
|
1695 | |
|
1696 | |
it 'should only add the section once' do
|
1697 | |
# "first_section" and "second_section".
|
1698 | |
- @doc.lines.to_a.length.should == 2
|
1699 | |
+ expect(@doc.lines.to_a.length).to eq(2)
|
1700 | |
end
|
1701 | |
|
1702 | |
it 'should retain values from the first time' do
|
1703 | |
- @doc['first_section']['key'].should == 'value'
|
1704 | |
+ expect(@doc['first_section']['key']).to eq('value')
|
1705 | |
end
|
1706 | |
|
1707 | |
it 'should add new keys' do
|
1708 | |
- @doc['first_section']['third'].should == 'fourth'
|
1709 | |
+ expect(@doc['first_section']['third']).to eq('fourth')
|
1710 | |
end
|
1711 | |
|
1712 | |
it 'should merge in duplicate keys' do
|
1713 | |
- @doc['first_section']['another'].should == %w( thing again )
|
1714 | |
+ expect(@doc['first_section']['another']).to eq(%w( thing again ))
|
1715 | |
end
|
1716 | |
end
|
1717 | |
end
|
1718 | |
diff --git a/spec/parser/line_parsing_spec.rb b/spec/parser/line_parsing_spec.rb
|
1719 | |
index 3183bc5..818da81 100644
|
1720 | |
--- a/spec/parser/line_parsing_spec.rb
|
1721 | |
+++ b/spec/parser/line_parsing_spec.rb
|
1722 | |
@@ -4,12 +4,12 @@ require 'spec_helper'
|
1723 | |
|
1724 | |
describe 'Parsing a line' do
|
1725 | |
it 'should strip leading whitespace and set the :indent option' do
|
1726 | |
- IniParse::Parser.parse_line(' [section]').should \
|
1727 | |
+ expect(IniParse::Parser.parse_line(' [section]')).to \
|
1728 | |
be_section_tuple(:any, {:indent => ' '})
|
1729 | |
end
|
1730 | |
|
1731 | |
it 'should raise an error if the line could not be matched' do
|
1732 | |
- lambda { IniParse::Parser.parse_line('invalid line') }.should \
|
1733 | |
+ expect { IniParse::Parser.parse_line('invalid line') }.to \
|
1734 | |
raise_error(IniParse::ParseError)
|
1735 | |
end
|
1736 | |
|
1737 | |
@@ -17,7 +17,7 @@ describe 'Parsing a line' do
|
1738 | |
begin
|
1739 | |
# Remove last type.
|
1740 | |
type = IniParse::Parser.parse_types.pop
|
1741 | |
- type.should_not_receive(:parse)
|
1742 | |
+ expect(type).not_to receive(:parse)
|
1743 | |
IniParse::Parser.parse_line('[section]')
|
1744 | |
ensure
|
1745 | |
IniParse::Parser.parse_types << type
|
1746 | |
@@ -36,20 +36,20 @@ describe 'Parsing a line' do
|
1747 | |
end
|
1748 | |
|
1749 | |
it 'should return an option tuple' do
|
1750 | |
- @tuple.should be_option_tuple('k', 'v')
|
1751 | |
+ expect(@tuple).to be_option_tuple('k', 'v')
|
1752 | |
end
|
1753 | |
|
1754 | |
it 'should set no indent, comment, offset or separator' do
|
1755 | |
- @tuple.last[:indent].should be_nil
|
1756 | |
- @tuple.last[:comment].should be_nil
|
1757 | |
- @tuple.last[:comment_offset].should be_nil
|
1758 | |
- @tuple.last[:comment_sep].should be_nil
|
1759 | |
+ expect(@tuple.last[:indent]).to be_nil
|
1760 | |
+ expect(@tuple.last[:comment]).to be_nil
|
1761 | |
+ expect(@tuple.last[:comment_offset]).to be_nil
|
1762 | |
+ expect(@tuple.last[:comment_sep]).to be_nil
|
1763 | |
end
|
1764 | |
end
|
1765 | |
|
1766 | |
describe 'with "k = a value with spaces"' do
|
1767 | |
it 'should return an option tuple' do
|
1768 | |
- IniParse::Parser.parse_line('k = a value with spaces').should \
|
1769 | |
+ expect(IniParse::Parser.parse_line('k = a value with spaces')).to \
|
1770 | |
be_option_tuple('k', 'a value with spaces')
|
1771 | |
end
|
1772 | |
end
|
1773 | |
@@ -60,19 +60,19 @@ describe 'Parsing a line' do
|
1774 | |
end
|
1775 | |
|
1776 | |
it 'should return an option tuple' do
|
1777 | |
- @tuple.should be_option_tuple('k', 'v')
|
1778 | |
+ expect(@tuple).to be_option_tuple('k', 'v')
|
1779 | |
end
|
1780 | |
|
1781 | |
it 'should set the comment to "a comment"' do
|
1782 | |
- @tuple.should be_option_tuple(:any, :any, :comment => 'a comment')
|
1783 | |
+ expect(@tuple).to be_option_tuple(:any, :any, :comment => 'a comment')
|
1784 | |
end
|
1785 | |
|
1786 | |
it 'should set the comment separator to ";"' do
|
1787 | |
- @tuple.should be_option_tuple(:any, :any, :comment_sep => ';')
|
1788 | |
+ expect(@tuple).to be_option_tuple(:any, :any, :comment_sep => ';')
|
1789 | |
end
|
1790 | |
|
1791 | |
it 'should set the comment offset to 6' do
|
1792 | |
- @tuple.should be_option_tuple(:any, :any, :comment_offset => 6)
|
1793 | |
+ expect(@tuple).to be_option_tuple(:any, :any, :comment_offset => 6)
|
1794 | |
end
|
1795 | |
end
|
1796 | |
|
1797 | |
@@ -82,13 +82,13 @@ describe 'Parsing a line' do
|
1798 | |
end
|
1799 | |
|
1800 | |
it 'should return an option tuple with the correct value' do
|
1801 | |
- @tuple.should be_option_tuple(:any, 'v;w;x y;z')
|
1802 | |
+ expect(@tuple).to be_option_tuple(:any, 'v;w;x y;z')
|
1803 | |
end
|
1804 | |
|
1805 | |
it 'should not set a comment' do
|
1806 | |
- @tuple.last[:comment].should be_nil
|
1807 | |
- @tuple.last[:comment_offset].should be_nil
|
1808 | |
- @tuple.last[:comment_sep].should be_nil
|
1809 | |
+ expect(@tuple.last[:comment]).to be_nil
|
1810 | |
+ expect(@tuple.last[:comment_offset]).to be_nil
|
1811 | |
+ expect(@tuple.last[:comment_sep]).to be_nil
|
1812 | |
end
|
1813 | |
end
|
1814 | |
|
1815 | |
@@ -98,58 +98,58 @@ describe 'Parsing a line' do
|
1816 | |
end
|
1817 | |
|
1818 | |
it 'should return an option tuple with the correct value' do
|
1819 | |
- @tuple.should be_option_tuple(:any, 'v;w')
|
1820 | |
+ expect(@tuple).to be_option_tuple(:any, 'v;w')
|
1821 | |
end
|
1822 | |
|
1823 | |
it 'should set the comment to "a comment"' do
|
1824 | |
- @tuple.should be_option_tuple(:any, :any, :comment => 'a comment')
|
1825 | |
+ expect(@tuple).to be_option_tuple(:any, :any, :comment => 'a comment')
|
1826 | |
end
|
1827 | |
|
1828 | |
it 'should set the comment separator to ";"' do
|
1829 | |
- @tuple.should be_option_tuple(:any, :any, :comment_sep => ';')
|
1830 | |
+ expect(@tuple).to be_option_tuple(:any, :any, :comment_sep => ';')
|
1831 | |
end
|
1832 | |
|
1833 | |
it 'should set the comment offset to 8' do
|
1834 | |
- @tuple.should be_option_tuple(:any, :any, :comment_offset => 8)
|
1835 | |
+ expect(@tuple).to be_option_tuple(:any, :any, :comment_offset => 8)
|
1836 | |
end
|
1837 | |
end
|
1838 | |
|
1839 | |
describe 'with "key=value"' do
|
1840 | |
it 'should return an option tuple with the correct key and value' do
|
1841 | |
- IniParse::Parser.parse_line('key=value').should \
|
1842 | |
+ expect(IniParse::Parser.parse_line('key=value')).to \
|
1843 | |
be_option_tuple('key', 'value')
|
1844 | |
end
|
1845 | |
end
|
1846 | |
|
1847 | |
describe 'with "key= value"' do
|
1848 | |
it 'should return an option tuple with the correct key and value' do
|
1849 | |
- IniParse::Parser.parse_line('key= value').should \
|
1850 | |
+ expect(IniParse::Parser.parse_line('key= value')).to \
|
1851 | |
be_option_tuple('key', 'value')
|
1852 | |
end
|
1853 | |
end
|
1854 | |
|
1855 | |
describe 'with "key =value"' do
|
1856 | |
it 'should return an option tuple with the correct key and value' do
|
1857 | |
- IniParse::Parser.parse_line('key =value').should \
|
1858 | |
+ expect(IniParse::Parser.parse_line('key =value')).to \
|
1859 | |
be_option_tuple('key', 'value')
|
1860 | |
end
|
1861 | |
end
|
1862 | |
|
1863 | |
describe 'with "key = value"' do
|
1864 | |
it 'should return an option tuple with the correct key and value' do
|
1865 | |
- IniParse::Parser.parse_line('key = value').should \
|
1866 | |
+ expect(IniParse::Parser.parse_line('key = value')).to \
|
1867 | |
be_option_tuple('key', 'value')
|
1868 | |
end
|
1869 | |
end
|
1870 | |
|
1871 | |
describe 'with "key ="' do
|
1872 | |
it 'should return an option tuple with the correct key' do
|
1873 | |
- IniParse::Parser.parse_line('key =').should \
|
1874 | |
+ expect(IniParse::Parser.parse_line('key =')).to \
|
1875 | |
be_option_tuple('key')
|
1876 | |
end
|
1877 | |
|
1878 | |
it 'should set the option value to nil' do
|
1879 | |
- IniParse::Parser.parse_line('key =').should \
|
1880 | |
+ expect(IniParse::Parser.parse_line('key =')).to \
|
1881 | |
be_option_tuple(:any, nil)
|
1882 | |
end
|
1883 | |
end
|
1884 | |
@@ -157,49 +157,49 @@ describe 'Parsing a line' do
|
1885 | |
|
1886 | |
describe 'with "key = EEjDDJJjDJDJD233232=="' do
|
1887 | |
it 'should include the "equals" in the option value' do
|
1888 | |
- IniParse::Parser.parse_line('key = EEjDDJJjDJDJD233232==').should \
|
1889 | |
+ expect(IniParse::Parser.parse_line('key = EEjDDJJjDJDJD233232==')).to \
|
1890 | |
be_option_tuple('key', 'EEjDDJJjDJDJD233232==')
|
1891 | |
end
|
1892 | |
end
|
1893 | |
|
1894 | |
describe 'with "key = ==EEjDDJJjDJDJD233232"' do
|
1895 | |
it 'should include the "equals" in the option value' do
|
1896 | |
- IniParse::Parser.parse_line('key = ==EEjDDJJjDJDJD233232').should \
|
1897 | |
+ expect(IniParse::Parser.parse_line('key = ==EEjDDJJjDJDJD233232')).to \
|
1898 | |
be_option_tuple('key', '==EEjDDJJjDJDJD233232')
|
1899 | |
end
|
1900 | |
end
|
1901 | |
|
1902 | |
describe 'with "key.two = value"' do
|
1903 | |
it 'should return an option tuple with the correct key' do
|
1904 | |
- IniParse::Parser.parse_line('key.two = value').should \
|
1905 | |
+ expect(IniParse::Parser.parse_line('key.two = value')).to \
|
1906 | |
be_option_tuple('key.two')
|
1907 | |
end
|
1908 | |
end
|
1909 | |
|
1910 | |
describe 'with "key/with/slashes = value"' do
|
1911 | |
it 'should return an option tuple with the correct key' do
|
1912 | |
- IniParse::Parser.parse_line('key/with/slashes = value').should \
|
1913 | |
+ expect(IniParse::Parser.parse_line('key/with/slashes = value')).to \
|
1914 | |
be_option_tuple('key/with/slashes', 'value')
|
1915 | |
end
|
1916 | |
end
|
1917 | |
|
1918 | |
describe 'with "key_with_underscores = value"' do
|
1919 | |
it 'should return an option tuple with the correct key' do
|
1920 | |
- IniParse::Parser.parse_line('key_with_underscores = value').should \
|
1921 | |
+ expect(IniParse::Parser.parse_line('key_with_underscores = value')).to \
|
1922 | |
be_option_tuple('key_with_underscores', 'value')
|
1923 | |
end
|
1924 | |
end
|
1925 | |
|
1926 | |
describe 'with "key-with-dashes = value"' do
|
1927 | |
it 'should return an option tuple with the correct key' do
|
1928 | |
- IniParse::Parser.parse_line('key-with-dashes = value').should \
|
1929 | |
+ expect(IniParse::Parser.parse_line('key-with-dashes = value')).to \
|
1930 | |
be_option_tuple('key-with-dashes', 'value')
|
1931 | |
end
|
1932 | |
end
|
1933 | |
|
1934 | |
describe 'with "key with spaces = value"' do
|
1935 | |
it 'should return an option tuple with the correct key' do
|
1936 | |
- IniParse::Parser.parse_line('key with spaces = value').should \
|
1937 | |
+ expect(IniParse::Parser.parse_line('key with spaces = value')).to \
|
1938 | |
be_option_tuple('key with spaces', 'value')
|
1939 | |
end
|
1940 | |
end
|
1941 | |
@@ -216,27 +216,27 @@ describe 'Parsing a line' do
|
1942 | |
end
|
1943 | |
|
1944 | |
it 'should return a section tuple' do
|
1945 | |
- @tuple.should be_section_tuple('section')
|
1946 | |
+ expect(@tuple).to be_section_tuple('section')
|
1947 | |
end
|
1948 | |
|
1949 | |
it 'should set no indent, comment, offset or separator' do
|
1950 | |
- @tuple.last[:indent].should be_nil
|
1951 | |
- @tuple.last[:comment].should be_nil
|
1952 | |
- @tuple.last[:comment_offset].should be_nil
|
1953 | |
- @tuple.last[:comment_sep].should be_nil
|
1954 | |
+ expect(@tuple.last[:indent]).to be_nil
|
1955 | |
+ expect(@tuple.last[:comment]).to be_nil
|
1956 | |
+ expect(@tuple.last[:comment_offset]).to be_nil
|
1957 | |
+ expect(@tuple.last[:comment_sep]).to be_nil
|
1958 | |
end
|
1959 | |
end
|
1960 | |
|
1961 | |
describe 'with "[section with whitespace]"' do
|
1962 | |
it 'should return a section tuple with the correct key' do
|
1963 | |
- IniParse::Parser.parse_line('[section with whitespace]').should \
|
1964 | |
+ expect(IniParse::Parser.parse_line('[section with whitespace]')).to \
|
1965 | |
be_section_tuple('section with whitespace')
|
1966 | |
end
|
1967 | |
end
|
1968 | |
|
1969 | |
describe 'with "[ section with surounding whitespace ]"' do
|
1970 | |
it 'should return a section tuple with the correct key' do
|
1971 | |
- IniParse::Parser.parse_line('[ section with surounding whitespace ]').should \
|
1972 | |
+ expect(IniParse::Parser.parse_line('[ section with surounding whitespace ]')).to \
|
1973 | |
be_section_tuple(' section with surounding whitespace ')
|
1974 | |
end
|
1975 | |
end
|
1976 | |
@@ -247,19 +247,19 @@ describe 'Parsing a line' do
|
1977 | |
end
|
1978 | |
|
1979 | |
it 'should return a section tuple' do
|
1980 | |
- @tuple.should be_section_tuple('section')
|
1981 | |
+ expect(@tuple).to be_section_tuple('section')
|
1982 | |
end
|
1983 | |
|
1984 | |
it 'should set the comment to "a comment"' do
|
1985 | |
- @tuple.should be_section_tuple(:any, :comment => 'a comment')
|
1986 | |
+ expect(@tuple).to be_section_tuple(:any, :comment => 'a comment')
|
1987 | |
end
|
1988 | |
|
1989 | |
it 'should set the comment separator to ";"' do
|
1990 | |
- @tuple.should be_section_tuple(:any, :comment_sep => ';')
|
1991 | |
+ expect(@tuple).to be_section_tuple(:any, :comment_sep => ';')
|
1992 | |
end
|
1993 | |
|
1994 | |
it 'should set the comment offset to 10' do
|
1995 | |
- @tuple.should be_section_tuple(:any, :comment_offset => 10)
|
1996 | |
+ expect(@tuple).to be_section_tuple(:any, :comment_offset => 10)
|
1997 | |
end
|
1998 | |
end
|
1999 | |
|
2000 | |
@@ -269,14 +269,14 @@ describe 'Parsing a line' do
|
2001 | |
end
|
2002 | |
|
2003 | |
it 'should return a section tuple with the correct key' do
|
2004 | |
- @tuple.should be_section_tuple('section;with#comment;chars')
|
2005 | |
+ expect(@tuple).to be_section_tuple('section;with#comment;chars')
|
2006 | |
end
|
2007 | |
|
2008 | |
it 'should not set a comment' do
|
2009 | |
- @tuple.last[:indent].should be_nil
|
2010 | |
- @tuple.last[:comment].should be_nil
|
2011 | |
- @tuple.last[:comment_offset].should be_nil
|
2012 | |
- @tuple.last[:comment_sep].should be_nil
|
2013 | |
+ expect(@tuple.last[:indent]).to be_nil
|
2014 | |
+ expect(@tuple.last[:comment]).to be_nil
|
2015 | |
+ expect(@tuple.last[:comment_offset]).to be_nil
|
2016 | |
+ expect(@tuple.last[:comment_sep]).to be_nil
|
2017 | |
end
|
2018 | |
end
|
2019 | |
|
2020 | |
@@ -286,19 +286,19 @@ describe 'Parsing a line' do
|
2021 | |
end
|
2022 | |
|
2023 | |
it 'should return a section tuple with the correct key' do
|
2024 | |
- @tuple.should be_section_tuple('section;with#comment;chars')
|
2025 | |
+ expect(@tuple).to be_section_tuple('section;with#comment;chars')
|
2026 | |
end
|
2027 | |
|
2028 | |
it 'should set the comment to "a comment"' do
|
2029 | |
- @tuple.should be_section_tuple(:any, :comment => 'a comment')
|
2030 | |
+ expect(@tuple).to be_section_tuple(:any, :comment => 'a comment')
|
2031 | |
end
|
2032 | |
|
2033 | |
it 'should set the comment separator to ";"' do
|
2034 | |
- @tuple.should be_section_tuple(:any, :comment_sep => ';')
|
2035 | |
+ expect(@tuple).to be_section_tuple(:any, :comment_sep => ';')
|
2036 | |
end
|
2037 | |
|
2038 | |
it 'should set the comment offset to 29' do
|
2039 | |
- @tuple.should be_section_tuple(:any, :comment_offset => 29)
|
2040 | |
+ expect(@tuple).to be_section_tuple(:any, :comment_offset => 29)
|
2041 | |
end
|
2042 | |
end
|
2043 | |
|
2044 | |
@@ -314,15 +314,15 @@ describe 'Parsing a line' do
|
2045 | |
end
|
2046 | |
|
2047 | |
it 'should return a comment tuple with the correct comment' do
|
2048 | |
- @tuple.should be_comment_tuple('a comment')
|
2049 | |
+ expect(@tuple).to be_comment_tuple('a comment')
|
2050 | |
end
|
2051 | |
|
2052 | |
it 'should set the comment separator to ";"' do
|
2053 | |
- @tuple.should be_comment_tuple(:any, :comment_sep => ';')
|
2054 | |
+ expect(@tuple).to be_comment_tuple(:any, :comment_sep => ';')
|
2055 | |
end
|
2056 | |
|
2057 | |
it 'should set the comment offset to 0' do
|
2058 | |
- @tuple.should be_comment_tuple(:any, :comment_offset => 0)
|
2059 | |
+ expect(@tuple).to be_comment_tuple(:any, :comment_offset => 0)
|
2060 | |
end
|
2061 | |
end
|
2062 | |
|
2063 | |
@@ -332,15 +332,15 @@ describe 'Parsing a line' do
|
2064 | |
end
|
2065 | |
|
2066 | |
it 'should return a comment tuple with the correct comment' do
|
2067 | |
- @tuple.should be_comment_tuple('a comment')
|
2068 | |
+ expect(@tuple).to be_comment_tuple('a comment')
|
2069 | |
end
|
2070 | |
|
2071 | |
it 'should set the comment separator to ";"' do
|
2072 | |
- @tuple.should be_comment_tuple(:any, :comment_sep => ';')
|
2073 | |
+ expect(@tuple).to be_comment_tuple(:any, :comment_sep => ';')
|
2074 | |
end
|
2075 | |
|
2076 | |
it 'should set the comment offset to 1' do
|
2077 | |
- @tuple.should be_comment_tuple(:any, :comment_offset => 1)
|
2078 | |
+ expect(@tuple).to be_comment_tuple(:any, :comment_offset => 1)
|
2079 | |
end
|
2080 | |
end
|
2081 | |
|
2082 | |
@@ -350,15 +350,15 @@ describe 'Parsing a line' do
|
2083 | |
end
|
2084 | |
|
2085 | |
it 'should return a comment tuple with an empty value' do
|
2086 | |
- @tuple.should be_comment_tuple('')
|
2087 | |
+ expect(@tuple).to be_comment_tuple('')
|
2088 | |
end
|
2089 | |
|
2090 | |
it 'should set the comment separator to ";"' do
|
2091 | |
- @tuple.should be_comment_tuple(:any, :comment_sep => ';')
|
2092 | |
+ expect(@tuple).to be_comment_tuple(:any, :comment_sep => ';')
|
2093 | |
end
|
2094 | |
|
2095 | |
it 'should set the comment offset to 0' do
|
2096 | |
- @tuple.should be_comment_tuple(:any, :comment_offset => 0)
|
2097 | |
+ expect(@tuple).to be_comment_tuple(:any, :comment_offset => 0)
|
2098 | |
end
|
2099 | |
end
|
2100 | |
|
2101 | |
@@ -370,13 +370,13 @@ describe 'Parsing a line' do
|
2102 | |
|
2103 | |
describe 'with ""' do
|
2104 | |
it 'should return a blank tuple' do
|
2105 | |
- IniParse::Parser.parse_line('').should be_blank_tuple
|
2106 | |
+ expect(IniParse::Parser.parse_line('')).to be_blank_tuple
|
2107 | |
end
|
2108 | |
end
|
2109 | |
|
2110 | |
describe 'with " "' do
|
2111 | |
it 'should return a blank tuple' do
|
2112 | |
- IniParse::Parser.parse_line(' ').should be_blank_tuple
|
2113 | |
+ expect(IniParse::Parser.parse_line(' ')).to be_blank_tuple
|
2114 | |
end
|
2115 | |
end
|
2116 | |
end
|
2117 | |
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
|
2118 | |
index 78e812d..891234d 100644
|
2119 | |
--- a/spec/spec_helper.rb
|
2120 | |
+++ b/spec/spec_helper.rb
|
2121 | |
@@ -26,7 +26,7 @@ module IniParse
|
2122 | |
"expected #{@expected} but got #{@target.class}"
|
2123 | |
end
|
2124 | |
|
2125 | |
- def negative_failure_message
|
2126 | |
+ def failure_message_when_negated
|
2127 | |
"expected #{@expected} to not be #{@target.class}"
|
2128 | |
end
|
2129 | |
|
2130 | |
@@ -68,7 +68,7 @@ module IniParse
|
2131 | |
"expected #{@expected_type} tuple #{@failure_message}"
|
2132 | |
end
|
2133 | |
|
2134 | |
- def negative_failure_message
|
2135 | |
+ def failure_message_when_negated
|
2136 | |
"expected #{@tuple.inspect} to not be #{@expected_type} tuple"
|
2137 | |
end
|
2138 | |
|
2139 | |
diff --git a/spec/spec_helper_spec.rb b/spec/spec_helper_spec.rb
|
2140 | |
index 178db71..141c5fb 100644
|
2141 | |
--- a/spec/spec_helper_spec.rb
|
2142 | |
+++ b/spec/spec_helper_spec.rb
|
2143 | |
@@ -8,19 +8,19 @@ require 'spec_helper'
|
2144 | |
|
2145 | |
describe 'An empty array' do
|
2146 | |
it 'should not pass be_section_tuple' do
|
2147 | |
- [].should_not be_section_tuple
|
2148 | |
+ expect([]).not_to be_section_tuple
|
2149 | |
end
|
2150 | |
|
2151 | |
it 'should not pass be_option_tuple' do
|
2152 | |
- [].should_not be_option_tuple
|
2153 | |
+ expect([]).not_to be_option_tuple
|
2154 | |
end
|
2155 | |
|
2156 | |
it 'should not pass be_blank_tuple' do
|
2157 | |
- [].should_not be_blank_tuple
|
2158 | |
+ expect([]).not_to be_blank_tuple
|
2159 | |
end
|
2160 | |
|
2161 | |
it 'should not pass be_comment_tuple' do
|
2162 | |
- [].should_not be_comment_tuple
|
2163 | |
+ expect([]).not_to be_comment_tuple
|
2164 | |
end
|
2165 | |
end
|
2166 | |
|
2167 | |
@@ -34,39 +34,39 @@ describe 'Line tuple [:section, "key", {:opt => "val"}]' do
|
2168 | |
before(:all) { @tuple = [:section, "key", {:opt => "val"}] }
|
2169 | |
|
2170 | |
it 'should pass be_section_tuple' do
|
2171 | |
- @tuple.should be_section_tuple
|
2172 | |
+ expect(@tuple).to be_section_tuple
|
2173 | |
end
|
2174 | |
|
2175 | |
it 'should pass be_section_tuple("key")' do
|
2176 | |
- @tuple.should be_section_tuple("key")
|
2177 | |
+ expect(@tuple).to be_section_tuple("key")
|
2178 | |
end
|
2179 | |
|
2180 | |
it 'should fail be_section_tuple("invalid")' do
|
2181 | |
- @tuple.should_not be_section_tuple("invalid")
|
2182 | |
+ expect(@tuple).not_to be_section_tuple("invalid")
|
2183 | |
end
|
2184 | |
|
2185 | |
it 'should pass be_section_tuple("key", {:opt => "val"})' do
|
2186 | |
- @tuple.should be_section_tuple("key", {:opt => "val"})
|
2187 | |
+ expect(@tuple).to be_section_tuple("key", {:opt => "val"})
|
2188 | |
end
|
2189 | |
|
2190 | |
it 'should not pass be_section_tuple("key", {:invalid => "val"})' do
|
2191 | |
- @tuple.should_not be_section_tuple("key", {:invalid => "val"})
|
2192 | |
+ expect(@tuple).not_to be_section_tuple("key", {:invalid => "val"})
|
2193 | |
end
|
2194 | |
|
2195 | |
it 'should not pass be_section_tuple("key", {:opt => "invalid"})' do
|
2196 | |
- @tuple.should_not be_section_tuple("key", {:opt => "invalid"})
|
2197 | |
+ expect(@tuple).not_to be_section_tuple("key", {:opt => "invalid"})
|
2198 | |
end
|
2199 | |
|
2200 | |
it 'should fail be_option_tuple' do
|
2201 | |
- @tuple.should_not be_option_tuple
|
2202 | |
+ expect(@tuple).not_to be_option_tuple
|
2203 | |
end
|
2204 | |
|
2205 | |
it 'should fail be_blank_tuple' do
|
2206 | |
- @tuple.should_not be_blank_tuple
|
2207 | |
+ expect(@tuple).not_to be_blank_tuple
|
2208 | |
end
|
2209 | |
|
2210 | |
it 'should fail be_comment_tuple' do
|
2211 | |
- @tuple.should_not be_comment_tuple
|
2212 | |
+ expect(@tuple).not_to be_comment_tuple
|
2213 | |
end
|
2214 | |
end
|
2215 | |
|
2216 | |
@@ -80,51 +80,51 @@ describe 'Line tuple [:option, "key", "val", {:opt => "val"}]' do
|
2217 | |
before(:all) { @tuple = [:option, "key", "val", {:opt => "val"}] }
|
2218 | |
|
2219 | |
it 'should fail be_section_tuple' do
|
2220 | |
- @tuple.should_not be_section_tuple
|
2221 | |
+ expect(@tuple).not_to be_section_tuple
|
2222 | |
end
|
2223 | |
|
2224 | |
it 'should pass be_option_tuple' do
|
2225 | |
- @tuple.should be_option_tuple
|
2226 | |
+ expect(@tuple).to be_option_tuple
|
2227 | |
end
|
2228 | |
|
2229 | |
it 'should pass be_option_tuple("key")' do
|
2230 | |
- @tuple.should be_option_tuple("key")
|
2231 | |
+ expect(@tuple).to be_option_tuple("key")
|
2232 | |
end
|
2233 | |
|
2234 | |
it 'should fail be_option_tuple("invalid")' do
|
2235 | |
- @tuple.should_not be_option_tuple("invalid")
|
2236 | |
+ expect(@tuple).not_to be_option_tuple("invalid")
|
2237 | |
end
|
2238 | |
|
2239 | |
it 'should pass be_option_tuple("key", "val")' do
|
2240 | |
- @tuple.should be_option_tuple("key", "val")
|
2241 | |
+ expect(@tuple).to be_option_tuple("key", "val")
|
2242 | |
end
|
2243 | |
|
2244 | |
it 'should pass be_option_tuple(:any, "val")' do
|
2245 | |
- @tuple.should be_option_tuple(:any, "val")
|
2246 | |
+ expect(@tuple).to be_option_tuple(:any, "val")
|
2247 | |
end
|
2248 | |
|
2249 | |
it 'should fail be_option_tuple("key", "invalid")' do
|
2250 | |
- @tuple.should_not be_option_tuple("key", "invalid")
|
2251 | |
+ expect(@tuple).not_to be_option_tuple("key", "invalid")
|
2252 | |
end
|
2253 | |
|
2254 | |
it 'should pass be_option_tuple("key", "val", { :opt => "val" })' do
|
2255 | |
- @tuple.should be_option_tuple("key", "val", { :opt => "val" })
|
2256 | |
+ expect(@tuple).to be_option_tuple("key", "val", { :opt => "val" })
|
2257 | |
end
|
2258 | |
|
2259 | |
it 'should fail be_option_tuple("key", "val", { :invalid => "val" })' do
|
2260 | |
- @tuple.should_not be_option_tuple("key", "val", { :invalid => "val" })
|
2261 | |
+ expect(@tuple).not_to be_option_tuple("key", "val", { :invalid => "val" })
|
2262 | |
end
|
2263 | |
|
2264 | |
it 'should fail be_option_tuple("key", "val", { :opt => "invalid" })' do
|
2265 | |
- @tuple.should_not be_option_tuple("key", "val", { :opt => "invalid" })
|
2266 | |
+ expect(@tuple).not_to be_option_tuple("key", "val", { :opt => "invalid" })
|
2267 | |
end
|
2268 | |
|
2269 | |
it 'should fail be_blank_tuple' do
|
2270 | |
- @tuple.should_not be_blank_tuple
|
2271 | |
+ expect(@tuple).not_to be_blank_tuple
|
2272 | |
end
|
2273 | |
|
2274 | |
it 'should fail be_comment_tuple' do
|
2275 | |
- @tuple.should_not be_comment_tuple
|
2276 | |
+ expect(@tuple).not_to be_comment_tuple
|
2277 | |
end
|
2278 | |
end
|
2279 | |
|
2280 | |
@@ -138,19 +138,19 @@ describe 'Line tuple [:blank]' do
|
2281 | |
before(:all) { @tuple = [:blank] }
|
2282 | |
|
2283 | |
it 'should fail be_section_tuple' do
|
2284 | |
- @tuple.should_not be_section_tuple
|
2285 | |
+ expect(@tuple).not_to be_section_tuple
|
2286 | |
end
|
2287 | |
|
2288 | |
it 'should fail be_option_tuple' do
|
2289 | |
- @tuple.should_not be_option_tuple
|
2290 | |
+ expect(@tuple).not_to be_option_tuple
|
2291 | |
end
|
2292 | |
|
2293 | |
it 'should pass be_blank_tuple' do
|
2294 | |
- @tuple.should be_blank_tuple
|
2295 | |
+ expect(@tuple).to be_blank_tuple
|
2296 | |
end
|
2297 | |
|
2298 | |
it 'should fail be_comment_tuple' do
|
2299 | |
- @tuple.should_not be_comment_tuple
|
2300 | |
+ expect(@tuple).not_to be_comment_tuple
|
2301 | |
end
|
2302 | |
end
|
2303 | |
|
2304 | |
@@ -164,38 +164,38 @@ describe 'Line tuple [:comment, "A comment", {:opt => "val"}]' do
|
2305 | |
before(:all) { @tuple = [:comment, "A comment", {:opt => "val"}] }
|
2306 | |
|
2307 | |
it 'should fail be_section_tuple' do
|
2308 | |
- @tuple.should_not be_section_tuple
|
2309 | |
+ expect(@tuple).not_to be_section_tuple
|
2310 | |
end
|
2311 | |
|
2312 | |
it 'should fail be_option_tuple' do
|
2313 | |
- @tuple.should_not be_option_tuple
|
2314 | |
+ expect(@tuple).not_to be_option_tuple
|
2315 | |
end
|
2316 | |
|
2317 | |
it 'should fail be_blank_tuple' do
|
2318 | |
- @tuple.should_not be_blank_tuple
|
2319 | |
+ expect(@tuple).not_to be_blank_tuple
|
2320 | |
end
|
2321 | |
|
2322 | |
it 'should pass be_comment_tuple' do
|
2323 | |
- @tuple.should be_comment_tuple
|
2324 | |
+ expect(@tuple).to be_comment_tuple
|
2325 | |
end
|
2326 | |
|
2327 | |
it 'should pass be_comment_tuple("A comment")' do
|
2328 | |
- @tuple.should be_comment_tuple("A comment")
|
2329 | |
+ expect(@tuple).to be_comment_tuple("A comment")
|
2330 | |
end
|
2331 | |
|
2332 | |
it 'should fail be_comment_tuple("Invalid")' do
|
2333 | |
- @tuple.should_not be_comment_tuple("Invalid")
|
2334 | |
+ expect(@tuple).not_to be_comment_tuple("Invalid")
|
2335 | |
end
|
2336 | |
|
2337 | |
it 'should pass be_comment_tuple("A comment", {:opt => "val"})' do
|
2338 | |
- @tuple.should be_comment_tuple("A comment", {:opt => "val"})
|
2339 | |
+ expect(@tuple).to be_comment_tuple("A comment", {:opt => "val"})
|
2340 | |
end
|
2341 | |
|
2342 | |
it 'should fail be_comment_tuple("A comment", {:invalid => "val"})' do
|
2343 | |
- @tuple.should_not be_comment_tuple("A comment", {:invalid => "val"})
|
2344 | |
+ expect(@tuple).not_to be_comment_tuple("A comment", {:invalid => "val"})
|
2345 | |
end
|
2346 | |
|
2347 | |
it 'should fail be_comment_tuple("A comment", {:opt => "invalid"})' do
|
2348 | |
- @tuple.should_not be_comment_tuple("A comment", {:opt => "invalid"})
|
2349 | |
+ expect(@tuple).not_to be_comment_tuple("A comment", {:opt => "invalid"})
|
2350 | |
end
|
2351 | |
end
|