glyph 0.5.2 → 0.5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS.textile +1 -0
  3. data/CHANGELOG.textile +104 -59
  4. data/Gemfile.lock +46 -0
  5. data/LICENSE.textile +1 -1
  6. data/README.textile +106 -120
  7. data/book/lib/layouts/bookindex.glyph +6 -106
  8. data/book/lib/layouts/bookpage.glyph +8 -108
  9. data/book/lib/layouts/project.glyph +0 -1
  10. data/book/text/acknowledgements.glyph +1 -0
  11. data/book/text/changelog.glyph +7 -1
  12. data/glyph.gemspec +10 -10
  13. data/lib/glyph.rb +1 -1
  14. data/spec/files/test.scss +1 -1
  15. data/spec/lib/analyzer_spec.rb +60 -61
  16. data/spec/lib/bookmark_spec.rb +21 -21
  17. data/spec/lib/commands_spec.rb +53 -54
  18. data/spec/lib/config_spec.rb +16 -16
  19. data/spec/lib/document_spec.rb +35 -35
  20. data/spec/lib/glyph_spec.rb +32 -32
  21. data/spec/lib/interpreter_spec.rb +8 -8
  22. data/spec/lib/macro_spec.rb +51 -49
  23. data/spec/lib/macro_validators_spec.rb +14 -14
  24. data/spec/lib/node_spec.rb +25 -25
  25. data/spec/lib/parser_spec.rb +26 -26
  26. data/spec/lib/reporter_spec.rb +32 -32
  27. data/spec/lib/syntax_node_spec.rb +33 -33
  28. data/spec/macros/core_spec.rb +95 -95
  29. data/spec/macros/filters_spec.rb +9 -8
  30. data/spec/macros/html5_spec.rb +17 -17
  31. data/spec/macros/macros_spec.rb +33 -33
  32. data/spec/macros/textile_spec.rb +15 -15
  33. data/spec/macros/web5_spec.rb +3 -3
  34. data/spec/macros/web_spec.rb +19 -19
  35. data/spec/macros/xml_spec.rb +15 -15
  36. data/spec/tasks/generate_spec.rb +34 -34
  37. data/spec/tasks/load_spec.rb +15 -15
  38. data/spec/tasks/project_spec.rb +15 -15
  39. data/styles/coderay.css +2 -0
  40. data/styles/coderay.css.map +7 -0
  41. data/styles/default.css +9 -7
  42. data/styles/default.css.map +7 -0
  43. data/styles/pagination.css +18 -23
  44. data/styles/pagination.css.map +7 -0
  45. data/tasks/generate.rake +12 -5
  46. metadata +47 -68
  47. data/glyph-0.5.1.gem +0 -0
@@ -10,55 +10,55 @@ describe Glyph::Bookmark do
10
10
  end
11
11
 
12
12
  it "should be initialized with at least an id" do
13
- lambda { Glyph::Bookmark.new }.should raise_error
14
- lambda { Glyph::Bookmark.new({:id => :test}) }.should_not raise_error
15
- lambda { Glyph::Bookmark.new({:file => "test"}) }.should raise_error
16
- lambda { Glyph::Bookmark.new({:id => "test", :file => "test.glyph"}) }.should_not raise_error
13
+ expect { Glyph::Bookmark.new }.to raise_error
14
+ expect { Glyph::Bookmark.new({:id => :test}) }.not_to raise_error
15
+ expect { Glyph::Bookmark.new({:file => "test"}) }.to raise_error
16
+ expect { Glyph::Bookmark.new({:id => "test", :file => "test.glyph"}) }.not_to raise_error
17
17
  end
18
18
 
19
19
  it "shiuld expose title, code and file" do
20
- @b.file.should == "test.glyph"
21
- @b.code.should == :test
22
- @b.title.should == nil
23
- Glyph::Bookmark.new(:id => :test2, :title => "Test 2").title.should == "Test 2"
20
+ expect(@b.file).to eq("test.glyph")
21
+ expect(@b.code).to eq(:test)
22
+ expect(@b.title).to eq(nil)
23
+ expect(Glyph::Bookmark.new(:id => :test2, :title => "Test 2").title).to eq("Test 2")
24
24
  end
25
25
 
26
26
  it "should convert to a string" do
27
27
  @b.code.to_s == @b.to_s
28
- "#{@b}".should == @b.to_s
28
+ expect("#{@b}").to eq(@b.to_s)
29
29
  end
30
30
 
31
31
  it "should format the link for a single output file" do
32
32
  # Link within the same file
33
- @b.link.should == "#test"
33
+ expect(@b.link).to eq("#test")
34
34
  # Link to a different file file
35
- @b.link('intro.glyph').should == "#test"
35
+ expect(@b.link('intro.glyph')).to eq("#test")
36
36
  end
37
37
 
38
38
  it "should format the link for multiple output files" do
39
39
  out = Glyph['document.output']
40
40
  Glyph['document.output'] = 'web'
41
41
  # Link within the same file
42
- @b.link("test.glyph").should == "#test"
42
+ expect(@b.link("test.glyph")).to eq("#test")
43
43
  # Link to a different file file
44
- @b.link("intro.glyph").should == "/test.html#test"
44
+ expect(@b.link("intro.glyph")).to eq("/test.html#test")
45
45
  # Test that base directory is added correctly
46
46
  Glyph["output.#{Glyph['document.output']}.base"] = ""
47
- @b.link("intro.glyph").should == "test.html#test"
48
- @b.link("test.glyph").should == "#test"
47
+ expect(@b.link("intro.glyph")).to eq("test.html#test")
48
+ expect(@b.link("test.glyph")).to eq("#test")
49
49
  Glyph['document.output'] = out
50
50
  end
51
51
 
52
52
  it "should check ID validity" do
53
- lambda { Glyph::Bookmark.new :id => "#test$", :file => "test.glyph"}.should raise_error(RuntimeError, "Invalid bookmark ID: #test$")
53
+ expect { Glyph::Bookmark.new :id => "#test$", :file => "test.glyph"}.to raise_error(RuntimeError, "Invalid bookmark ID: #test$")
54
54
  end
55
55
 
56
56
  it "should check bookmark equality" do
57
- @b.should == Glyph::Bookmark.new(:id => :test, :file => 'test.glyph')
58
- @b.should == Glyph::Bookmark.new(:id => :test, :file => "test.glyph")
59
- @b.should == Glyph::Bookmark.new(:id => :test, :file => 'test.glyph', :level => 2)
60
- @b.should_not == Glyph::Bookmark.new(:id => :test1, :file => 'test.glyph')
61
- @b.should_not == Glyph::Bookmark.new(:id => :test, :file => 'test1.glyph')
57
+ expect(@b).to eq(Glyph::Bookmark.new(:id => :test, :file => 'test.glyph'))
58
+ expect(@b).to eq(Glyph::Bookmark.new(:id => :test, :file => "test.glyph"))
59
+ expect(@b).to eq(Glyph::Bookmark.new(:id => :test, :file => 'test.glyph', :level => 2))
60
+ expect(@b).not_to eq(Glyph::Bookmark.new(:id => :test1, :file => 'test.glyph'))
61
+ expect(@b).not_to eq(Glyph::Bookmark.new(:id => :test, :file => 'test1.glyph'))
62
62
  end
63
63
 
64
64
  end
@@ -19,57 +19,57 @@ describe "glyph" do
19
19
  delete_project
20
20
  Glyph.enable "project:create"
21
21
  Dir.chdir Glyph::PROJECT.to_s
22
- run_command_successfully(['init']).should == true
22
+ expect(run_command_successfully(['init'])).to eq(true)
23
23
  end
24
24
 
25
25
  it "[config] should read configuration settings" do
26
26
  create_project
27
- run_command_with_status(["config", "-g"]).should == -10
28
- run_command(["config", "document.output"]).match(/html/m).should_not == nil
27
+ expect(run_command_with_status(["config", "-g"])).to eq(-10)
28
+ expect(run_command(["config", "document.output"]).match(/html/m)).not_to eq(nil)
29
29
  end
30
30
 
31
31
  it "[config] should write configuration settings" do
32
32
  create_project
33
- run_command_successfully(["config", "test_setting", "true"]).should == true
34
- Glyph::CONFIG.get(:test_setting).should == true
33
+ expect(run_command_successfully(["config", "test_setting", "true"])).to eq(true)
34
+ expect(Glyph::CONFIG.get(:test_setting)).to eq(true)
35
35
  Glyph::PROJECT_CONFIG.read
36
- Glyph::PROJECT_CONFIG.get('test_setting').should == true
36
+ expect(Glyph::PROJECT_CONFIG.get('test_setting')).to eq(true)
37
37
  Glyph::GLOBAL_CONFIG.read
38
- Glyph::GLOBAL_CONFIG.get('test_setting').should_not == true
39
- run_command_successfully(["config", "-g", "another.test", "something else"]).should == true
40
- (Glyph::SPEC_DIR/'.glyphrc').exist?.should == true
41
- Glyph::CONFIG.get("another.test").should == "something else"
38
+ expect(Glyph::GLOBAL_CONFIG.get('test_setting')).not_to eq(true)
39
+ expect(run_command_successfully(["config", "-g", "another.test", "something else"])).to eq(true)
40
+ expect((Glyph::SPEC_DIR/'.glyphrc').exist?).to eq(true)
41
+ expect(Glyph::CONFIG.get("another.test")).to eq("something else")
42
42
  Glyph::PROJECT_CONFIG.read
43
- Glyph::PROJECT_CONFIG.get('another.test').should_not == "something else"
43
+ expect(Glyph::PROJECT_CONFIG.get('another.test')).not_to eq("something else")
44
44
  Glyph::GLOBAL_CONFIG.read
45
- Glyph::GLOBAL_CONFIG.get('another.test').should == "something else"
45
+ expect(Glyph::GLOBAL_CONFIG.get('another.test')).to eq("something else")
46
46
  (Glyph::SPEC_DIR/'.glyphrc').unlink
47
47
  end
48
48
 
49
49
  it "[config] should not overwrite system settings" do
50
50
  create_project
51
51
  Glyph['system.test_setting'] = false
52
- run_command(["config", "system.test_setting", "true"]).match(/warning.+\(system use only\)/m).should_not == nil
53
- Glyph['system.test_setting'].should == false
52
+ expect(run_command(["config", "system.test_setting", "true"]).match(/warning.+\(system use only\)/m)).not_to eq(nil)
53
+ expect(Glyph['system.test_setting']).to eq(false)
54
54
  end
55
55
 
56
56
  it "[add] should create a new text file" do
57
57
  create_project
58
- run_command_successfully(["add", "test.textile"]).should == true
59
- (Glyph::PROJECT/'text/test.textile').exist?.should == true
58
+ expect(run_command_successfully(["add", "test.textile"])).to eq(true)
59
+ expect((Glyph::PROJECT/'text/test.textile').exist?).to eq(true)
60
60
  end
61
61
 
62
62
  it "[compile] should compile the project" do
63
63
  create_project
64
- run_command(["compile"]).match(/test_project\.html/m).should_not == nil
65
- (Glyph::PROJECT/'output/html/test_project.html').exist?.should == true
64
+ expect(run_command(["compile"]).match(/test_project\.html/m)).not_to eq(nil)
65
+ expect((Glyph::PROJECT/'output/html/test_project.html').exist?).to eq(true)
66
66
  end
67
67
 
68
68
  it "[compile] should support a custom source file" do
69
69
  create_project
70
70
  file_copy Glyph::PROJECT/'document.glyph', Glyph::PROJECT/'custom.glyph'
71
- run_command(["-d", "compile", "-s", "custom.glyph"]).match(/custom\.glyph/m).should_not == nil
72
- (Glyph::PROJECT/'output/html/test_project.html').exist?.should == true
71
+ expect(run_command(["-d", "compile", "-s", "custom.glyph"]).match(/custom\.glyph/m)).not_to eq(nil)
72
+ expect((Glyph::PROJECT/'output/html/test_project.html').exist?).to eq(true)
73
73
  end
74
74
 
75
75
  it "[compile] should not continue execution in case of macro errors" do
@@ -84,10 +84,10 @@ describe "glyph" do
84
84
  }
85
85
  file_write Glyph::PROJECT/'document.glyph', text
86
86
  res = run_command(["compile"])
87
- res.match(/Bookmark 'invalid1' does not exist/).should_not == nil
88
- res.match(/Bookmark 'invalid2' does not exist/).should_not == nil
89
- res.match(/Bookmark 'valid' does not exist/).should == nil
90
- res.match(/Snippet 'invalid3' does not exist/).should_not == nil
87
+ expect(res.match(/Bookmark 'invalid1' does not exist/)).not_to eq(nil)
88
+ expect(res.match(/Bookmark 'invalid2' does not exist/)).not_to eq(nil)
89
+ expect(res.match(/Bookmark 'valid' does not exist/)).to eq(nil)
90
+ expect(res.match(/Snippet 'invalid3' does not exist/)).not_to eq(nil)
91
91
  end
92
92
 
93
93
  it "[compile] should regenerate output with auto switch set" do
@@ -122,17 +122,17 @@ describe "glyph" do
122
122
  compile_thread.join
123
123
 
124
124
  output2 = file_load output_file
125
- output.should_not == output2
126
- output2.match(/<p>This is another test.<\/p>/).should_not == nil
125
+ expect(output).not_to eq(output2)
126
+ expect(output2.match(/<p>This is another test.<\/p>/)).not_to eq(nil)
127
127
 
128
- res.match(/Auto-regeneration enabled/).should_not == nil
129
- res.match(/Regeneration started: 1 files changed/).should_not == nil
128
+ expect(res.match(/Auto-regeneration enabled/)).not_to eq(nil)
129
+ expect(res.match(/Regeneration started: 1 files changed/)).not_to eq(nil)
130
130
  reset_quiet
131
131
  end
132
132
 
133
133
  it "[compile] should not compile the project in case of an unknown output format" do
134
134
  reset_quiet
135
- run_command_successfully(["compile", "-f", "wrong"]).should == false
135
+ expect(run_command_successfully(["compile", "-f", "wrong"])).to eq(false)
136
136
  end
137
137
 
138
138
  it "[compile] should compile a single source file" do
@@ -140,14 +140,13 @@ describe "glyph" do
140
140
  Dir.chdir Glyph::PROJECT
141
141
  file_copy "#{Glyph::PROJECT}/../files/article.glyph", "#{Glyph::PROJECT}/article.glyph"
142
142
  file_copy "#{Glyph::PROJECT}/../files/ligature.jpg", "#{Glyph::PROJECT}/ligature.jpg"
143
- run_command_successfully(["compile", "article.glyph"]).should == true
144
- Pathname.new('article.html').exist?.should == true
145
- compact_html(file_load('article.html')).should == compact_html(%{
146
- <?xml version="1.0"?>
143
+ expect(run_command_successfully(["compile", "article.glyph"])).to eq(true)
144
+ expect(Pathname.new('article.html').exist?).to eq(true)
145
+ expect(compact_html(file_load('article.html'))).to eq(compact_html(%{
147
146
  <div class="section">
148
- &#x6539;&#x5584; Test -- Test Snippet
147
+ 改善 Test -- Test Snippet
149
148
  </div>
150
- })
149
+ }))
151
150
  (Glyph::PROJECT/'article.html').unlink
152
151
  Glyph['document.output'] = 'pdf'
153
152
  src = Glyph::PROJECT/'article.html'
@@ -155,9 +154,9 @@ describe "glyph" do
155
154
  Glyph.enable 'generate:html'
156
155
  Glyph.enable 'generate:pdf'
157
156
  Glyph.enable 'generate:pdf_through_html'
158
- run_command_successfully(["compile", "article.glyph"]).should == true
159
- src.exist?.should == true
160
- out.exist?.should == true
157
+ expect(run_command_successfully(["compile", "article.glyph"])).to eq(true)
158
+ expect(src.exist?).to eq(true)
159
+ expect(out.exist?).to eq(true)
161
160
  out.unlink
162
161
  Glyph.lite_mode = false
163
162
  end
@@ -167,9 +166,9 @@ describe "glyph" do
167
166
  Dir.chdir Glyph::PROJECT
168
167
  file_copy "#{Glyph::PROJECT}/../files/article.glyph", "#{Glyph::PROJECT}/article.glyph"
169
168
  file_copy "#{Glyph::PROJECT}/../files/ligature.jpg", "#{Glyph::PROJECT}/ligature.jpg"
170
- run_command_successfully(["compile", "article.glyph", "out/article.htm"]).should == true
169
+ expect(run_command_successfully(["compile", "article.glyph", "out/article.htm"])).to eq(true)
171
170
  Glyph.lite_mode = false
172
- Pathname.new('out/article.htm').exist?.should == true
171
+ expect(Pathname.new('out/article.htm').exist?).to eq(true)
173
172
  end
174
173
 
175
174
  it "[compile] should finalize the document in case of errors in included files" do
@@ -180,8 +179,8 @@ describe "glyph" do
180
179
  err = "Document cannot be finalized due to previous errors"
181
180
  res = run_command(["compile"])
182
181
  out = file_load Glyph::PROJECT/'output/html/test_project.html'
183
- compact_html(out).should == %{<?xml version="1.0"?><div class="section"><h2 id="h_1" class="toc">Test</h2></div>}
184
- res.match("error: #{err}").should == nil
182
+ expect(compact_html(out)).to eq(%{<div class="section"><h2 id="h_1" class="toc">Test</h2></div>})
183
+ expect(res.match("error: #{err}")).to eq(nil)
185
184
  end
186
185
 
187
186
  it "[outline] should display the document outline" do
@@ -199,25 +198,25 @@ test_project - Outline
199
198
  i_id = "[#h_2]"
200
199
  m_id = "[#md]"
201
200
  file_write Glyph::PROJECT/'document.glyph', "document[#{file_load(Glyph::PROJECT/'document.glyph')}]"
202
- run_command(["-d", "outline"]).should == %{#{start}
201
+ expect(run_command(["-d", "outline"])).to eq(%{#{start}
203
202
  #{c_title}
204
203
  #{i_title}
205
204
  #{m_title}
206
- }
205
+ })
207
206
  reset_quiet
208
- run_command(["outline", "-l", "1"]).should == %{#{start}
207
+ expect(run_command(["outline", "-l", "1"])).to eq(%{#{start}
209
208
  #{c_title}
210
209
  #{m_title}
211
- }
210
+ })
212
211
  reset_quiet
213
- run_command(["outline", "-ift"]).should == %{#{start}
212
+ expect(run_command(["outline", "-ift"])).to eq(%{#{start}
214
213
  #{c_file}
215
214
  #{c_title}#{c_id}
216
215
  #{i_file}
217
216
  #{i_title}#{i_id}
218
217
  #{m_file}
219
218
  #{m_title}#{m_id}
220
- }
219
+ })
221
220
  end
222
221
 
223
222
  it "[stats] should display project statistics" do
@@ -225,14 +224,14 @@ test_project - Outline
225
224
  create_project
226
225
  out = run_command(["stats", "-ms"])
227
226
  total_macros = (Glyph::MACROS.keys - Glyph::ALIASES[:by_alias].keys).uniq.length
228
- out.should match "-- Total Macro Definitions: #{total_macros}"
227
+ expect(out).to match "-- Total Macro Definitions: #{total_macros}"
229
228
  out = run_command(["stats"])
230
- out.should match "-- Total Macro Definitions: #{total_macros}"
231
- out.should match "-- Total Unreferenced Bookmarks: 3"
229
+ expect(out).to match "-- Total Macro Definitions: #{total_macros}"
230
+ expect(out).to match "-- Total Unreferenced Bookmarks: 3"
232
231
  out = run_command(["stats", "-lb", "--bookmark=md"])
233
- out.should match "-- Unreferenced Bookmarks: h_1, h_2, md"
234
- out.should match "-- Defined in: text/a/b/c/markdown.markdown"
235
- out.should_not match "-- Total Macro Definitions: 19"
232
+ expect(out).to match "-- Unreferenced Bookmarks: h_1, h_2, md"
233
+ expect(out).to match "-- Defined in: text/a/b/c/markdown.markdown"
234
+ expect(out).not_to match "-- Total Macro Definitions: 19"
236
235
  end
237
236
 
238
237
  end
@@ -19,34 +19,34 @@ describe Glyph::Config do
19
19
 
20
20
  it "should load a YAML configuration file" do
21
21
  @write_config_file.call @invalid
22
- lambda { @cfg.read }.should raise_error
22
+ expect { @cfg.read }.to raise_error
23
23
  @write_config_file.call @valid
24
- @cfg.read.should == {:test => true}
24
+ expect(@cfg.read).to eq({:test => true})
25
25
  end
26
26
 
27
27
  it "should get and set configuration data through dot notation" do
28
28
  @write_config_file.call @valid
29
29
  @cfg.read
30
- lambda { @cfg.set :test, false }.should_not raise_error
31
- lambda { @cfg.set "test.wrong", true}.should raise_error
32
- lambda { @cfg.set "test2.value", true}.should_not raise_error
33
- @cfg.get("test2.value").should == true
34
- lambda { @cfg.set "test2.value", "false"}.should_not raise_error
35
- @cfg.get("test2.value").should == false
36
- @cfg.get("test2.value2").should == nil
37
- @cfg.to_hash.should == {:test => false, :test2 => {:value => false}}
30
+ expect { @cfg.set :test, false }.not_to raise_error
31
+ expect { @cfg.set "test.wrong", true}.to raise_error
32
+ expect { @cfg.set "test2.value", true}.not_to raise_error
33
+ expect(@cfg.get("test2.value")).to eq(true)
34
+ expect { @cfg.set "test2.value", "false"}.not_to raise_error
35
+ expect(@cfg.get("test2.value")).to eq(false)
36
+ expect(@cfg.get("test2.value2")).to eq(nil)
37
+ expect(@cfg.to_hash).to eq({:test => false, :test2 => {:value => false}})
38
38
  end
39
39
 
40
40
  it "can be resetted with a Hash, if resettable" do
41
- lambda { @cfg.reset }.should raise_error
41
+ expect { @cfg.reset }.to raise_error
42
42
  cfg2 = Glyph::Config.new :resettable => true
43
43
  cfg2.reset :test => "reset!"
44
- cfg2.to_hash.should == {:test => "reset!"}
44
+ expect(cfg2.to_hash).to eq({:test => "reset!"})
45
45
  end
46
46
 
47
47
  it "should be set to an empty Hash by default" do
48
48
  cfg2 = Glyph::Config.new
49
- cfg2.to_hash.should == {}
49
+ expect(cfg2.to_hash).to eq({})
50
50
  end
51
51
 
52
52
  it "should write a YAML configuration file" do
@@ -58,7 +58,7 @@ describe Glyph::Config do
58
58
  @cfg.write
59
59
  cfg2 = Glyph::Config.new :file => @config_path
60
60
  cfg2.read
61
- cfg2.to_hash.should == @cfg.to_hash
61
+ expect(cfg2.to_hash).to eq(@cfg.to_hash)
62
62
  end
63
63
 
64
64
  it "should merge with another Config without data loss" do
@@ -70,9 +70,9 @@ describe Glyph::Config do
70
70
  cfg2 = Glyph::Config.new :file => @config_path
71
71
  @cfg.update cfg2
72
72
  updated = {:a =>1, :b => {:b1 => 1111, :b2 => 2222, :b3 => {:b11 => 1, :b12 =>2222}, :b4 => 4}, :c=> 3}
73
- @cfg.to_hash.should == updated
73
+ expect(@cfg.to_hash).to eq(updated)
74
74
  hash1.merge! hash2
75
- hash1.should == {:a =>1, :b => {:b1 => 1111, :b2 => 2222, :b3 => {:b12 =>2222}}, :c=> 3}
75
+ expect(hash1).to eq({:a =>1, :b => {:b1 => 1111, :b2 => 2222, :b3 => {:b12 =>2222}}, :c=> 3})
76
76
  end
77
77
 
78
78
 
@@ -16,30 +16,30 @@ describe Glyph::Document do
16
16
  end
17
17
 
18
18
  it "should expose document data" do
19
- @doc.bookmarks.should == {}
20
- @doc.headers.should == {}
21
- @doc.styles.should == []
22
- @doc.placeholders.should == {}
23
- @doc.new?.should == true
19
+ expect(@doc.bookmarks).to eq({})
20
+ expect(@doc.headers).to eq({})
21
+ expect(@doc.styles).to eq([])
22
+ expect(@doc.placeholders).to eq({})
23
+ expect(@doc.new?).to eq(true)
24
24
  end
25
25
 
26
26
  it "should store bookmarks" do
27
- lambda { @doc.bookmark(:id => "test", :title => "Test Bookmark #1", :file => 'test.glyph')}.should_not raise_error
28
- lambda { @doc.bookmark(:id => :test, :title => "Test Bookmark #1", :file => 'test.glyph')}.should raise_error
29
- lambda { @doc.bookmark(:id => :test, :title => "Test Bookmark #2", :file => 'test2.glyph')}.should raise_error
30
- @doc.bookmarks.length.should == 1
31
- @doc.bookmarks[:test].should == Glyph::Bookmark.new(:id => :test, :title => "Test Bookmark #1", :file => "test.glyph")
27
+ expect { @doc.bookmark(:id => "test", :title => "Test Bookmark #1", :file => 'test.glyph')}.not_to raise_error
28
+ expect { @doc.bookmark(:id => :test, :title => "Test Bookmark #1", :file => 'test.glyph')}.to raise_error
29
+ expect { @doc.bookmark(:id => :test, :title => "Test Bookmark #2", :file => 'test2.glyph')}.to raise_error
30
+ expect(@doc.bookmarks.length).to eq(1)
31
+ expect(@doc.bookmarks[:test]).to eq(Glyph::Bookmark.new(:id => :test, :title => "Test Bookmark #1", :file => "test.glyph"))
32
32
  end
33
33
 
34
34
  it "should store placeholders" do
35
35
  p = lambda { "test" }
36
- lambda { @doc.placeholder &p }.should_not raise_error
37
- @doc.placeholders["‡‡‡‡‡PLACEHOLDER¤1‡‡‡‡‡".to_sym].should == p
36
+ expect { @doc.placeholder &p }.not_to raise_error
37
+ expect(@doc.placeholders["‡‡‡‡‡PLACEHOLDER¤1‡‡‡‡‡".to_sym]).to eq(p)
38
38
  end
39
39
 
40
40
  it "should store styles" do
41
- lambda {@doc.style "test.css"}.should_not raise_error
42
- @doc.styles.include?(Pathname.new('test.css')).should == true
41
+ expect {@doc.style "test.css"}.not_to raise_error
42
+ expect(@doc.styles.include?(Pathname.new('test.css'))).to eq(true)
43
43
  end
44
44
 
45
45
  it "can inherit data from another document" do
@@ -50,33 +50,33 @@ describe Glyph::Document do
50
50
  @doc.header :id => :test3, :title => "Test #3", :level => 3, :file => "test.glyph"
51
51
  @doc.toc[:contents] = "TOC goes here..."
52
52
  doc2 = create_doc @tree
53
- doc2.bookmarks.length.should == 0
54
- doc2.placeholders.length.should == 0
53
+ expect(doc2.bookmarks.length).to eq(0)
54
+ expect(doc2.placeholders.length).to eq(0)
55
55
  doc2.bookmark :id => :test4, :title => "Test #4", :file => "test.glyph"
56
56
  doc2.inherit_from @doc
57
- doc2.bookmarks.length.should == 3
58
- doc2.placeholders.length.should == 1
59
- doc2.headers.length.should == 1
60
- doc2.styles.length.should == 1
57
+ expect(doc2.bookmarks.length).to eq(3)
58
+ expect(doc2.placeholders.length).to eq(1)
59
+ expect(doc2.headers.length).to eq(1)
60
+ expect(doc2.styles.length).to eq(1)
61
61
  doc2.toc[:contents] = "TOC goes here..."
62
- doc2.bookmarks[0].should_not == Glyph::Bookmark.new(:id => :test4, :title => "Test #4", :file => "test.glyph")
62
+ expect(doc2.bookmarks[0]).not_to eq(Glyph::Bookmark.new(:id => :test4, :title => "Test #4", :file => "test.glyph"))
63
63
  end
64
64
 
65
65
  it "should analyze the syntax tree and finalize the document" do
66
- lambda { @doc.output }.should raise_error
67
- lambda { @doc.finalize }.should raise_error
68
- lambda { @doc.analyze }.should_not raise_error
69
- lambda { @doc.analyze }.should raise_error
70
- @doc.analyzed?.should == true
71
- lambda { @doc.output }.should raise_error
72
- lambda { @doc.finalize }.should_not raise_error
73
- @doc.output.should == "Test: Test: Test: Test|]..."
66
+ expect { @doc.output }.to raise_error
67
+ expect { @doc.finalize }.to raise_error
68
+ expect { @doc.analyze }.not_to raise_error
69
+ expect { @doc.analyze }.to raise_error
70
+ expect(@doc.analyzed?).to eq(true)
71
+ expect { @doc.output }.to raise_error
72
+ expect { @doc.finalize }.not_to raise_error
73
+ expect(@doc.output).to eq("Test: Test: Test: Test|]...")
74
74
  end
75
75
 
76
76
  it "should expose document structure" do
77
- lambda { @doc.structure }.should raise_error
77
+ expect { @doc.structure }.to raise_error
78
78
  @doc.analyze
79
- @doc.structure.is_a?(Node).should == true
79
+ expect(@doc.structure.is_a?(Node)).to eq(true)
80
80
  end
81
81
 
82
82
  it "should substitute placeholders when finalizing" do
@@ -105,7 +105,7 @@ describe Glyph::Document do
105
105
  doc = create_doc tree
106
106
  doc.analyze
107
107
  doc.finalize
108
- doc.output.gsub(/\n|\t/, '')[0..14].should == "Total: 4 tests."
108
+ expect(doc.output.gsub(/\n|\t/, '')[0..14]).to eq("Total: 4 tests.")
109
109
  end
110
110
 
111
111
  it "should substitute escaped pipes only when finalizing the document" do
@@ -119,7 +119,7 @@ describe Glyph::Document do
119
119
  doc = create_doc tree
120
120
  doc.analyze
121
121
  doc.finalize
122
- doc.output.should == result
122
+ expect(doc.output).to eq(result)
123
123
  end
124
124
 
125
125
  it "should store the Table of Contents" do
@@ -145,7 +145,7 @@ describe Glyph::Document do
145
145
  doc = create_doc tree
146
146
  doc.analyze
147
147
  doc.finalize
148
- doc.toc[:contents].match(%{<div class="contents">}).blank?.should == false
148
+ expect(doc.toc[:contents].match(%{<div class="contents">}).blank?).to eq(false)
149
149
  reset_quiet
150
150
  end
151
151
 
@@ -155,7 +155,7 @@ describe Glyph::Document do
155
155
  Glyph.run! "load:all"
156
156
  doc = create_doc create_tree("testing ##[frag1|fragments!] -- ##[frag2|another fragment]")
157
157
  doc.analyze
158
- doc.fragments.should == {:frag1 => "fragments!", :frag2 => "another fragment"}
158
+ expect(doc.fragments).to eq({:frag1 => "fragments!", :frag2 => "another fragment"})
159
159
  reset_quiet
160
160
  end
161
161