staticmatic 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -7
- data/VERSION.yml +1 -1
- data/bin/staticmatic +0 -0
- data/lib/staticmatic/base.rb +3 -1
- data/lib/staticmatic/helpers.rb +9 -3
- data/lib/staticmatic/templates/default/application.sass +3 -3
- data/lib/staticmatic.rb +1 -0
- data/spec/base_spec.rb +13 -0
- data/spec/helpers_spec.rb +29 -0
- data/spec/render_spec.rb +31 -0
- data/spec/rescue_spec.rb +36 -0
- data/{test → spec}/sandbox/test_site/configuration.rb +0 -0
- data/{test → spec}/sandbox/test_site/site/index +0 -0
- data/{test → spec}/sandbox/test_site/site/index.html +0 -0
- data/{test → spec}/sandbox/test_site/site/layout_test +0 -0
- data/{test → spec}/sandbox/test_site/site/page_with_error +0 -0
- data/{test → spec}/sandbox/test_site/site/page_with_partial_error +0 -0
- data/{test → spec}/sandbox/test_site/site/stylesheets/application.css +0 -0
- data/{test → spec}/sandbox/test_site/site/sub_folder/another_sub_folder/index.html +0 -0
- data/{test → spec}/sandbox/test_site/site/sub_folder/another_sub_folder/index.html.html +0 -0
- data/{test → spec}/sandbox/test_site/site/sub_folder/another_sub_folder. +0 -0
- data/{test → spec}/sandbox/test_site/site/sub_folder/index.html +0 -0
- data/{test → spec}/sandbox/test_site/src/helpers/application_helper.rb +0 -0
- data/{test → spec}/sandbox/test_site/src/layouts/alternate_layout.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/layouts/application.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/layouts/projects.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/pages/hello_world.erb +0 -0
- data/{test → spec}/sandbox/test_site/src/pages/index.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/pages/layout_test.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/pages/page_with_error.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/pages/page_with_partial_error.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/partials/menu.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/partials/partial_with_error.haml +0 -0
- data/{test → spec}/sandbox/test_site/src/stylesheets/application.sass +0 -0
- data/{test → spec}/sandbox/test_site/src/stylesheets/css_with_error.sass +0 -0
- data/spec/sandbox/test_site/src/stylesheets/nested/a_nested_stylesheet.sass +0 -0
- data/spec/sandbox/test_site/src/stylesheets/partials/_forms.sass +2 -0
- data/spec/server_spec.rb +12 -0
- data/{test/setup_test.rb → spec/setup_spec.rb} +5 -5
- data/spec/spec_helper.rb +14 -0
- data/{test/template_error_test.rb → spec/template_error_spec.rb} +7 -7
- metadata +46 -44
- data/test/base_test.rb +0 -13
- data/test/helpers_test.rb +0 -12
- data/test/render_test.rb +0 -30
- data/test/rescue_test.rb +0 -36
- data/test/server_test.rb +0 -12
- data/test/test_helper.rb +0 -20
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "rubygems"
|
2
|
-
require
|
3
|
-
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
4
|
require File.dirname(__FILE__) + '/lib/staticmatic'
|
5
5
|
|
6
6
|
begin
|
@@ -15,7 +15,7 @@ begin
|
|
15
15
|
gem.authors = ["Stephen Bartholomew"]
|
16
16
|
gem.rubyforge_project = "staticmatic"
|
17
17
|
|
18
|
-
gem.files = FileList["[A-Z]*", "{bin,lib,
|
18
|
+
gem.files = FileList["[A-Z]*", "{bin,lib,spec}/**/*"]
|
19
19
|
|
20
20
|
gem.add_dependency("haml", ">=2.0.0")
|
21
21
|
gem.add_dependency("mongrel", ">=1.1.5")
|
@@ -24,8 +24,8 @@ rescue LoadError
|
|
24
24
|
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gemgem.github.com"
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
28
|
+
spec.libs << 'lib' << 'spec'
|
29
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
30
|
+
# spec.spec_opts = ['--options', 'spec/spec.opts']
|
31
31
|
end
|
data/VERSION.yml
CHANGED
data/bin/staticmatic
CHANGED
File without changes
|
data/lib/staticmatic/base.rb
CHANGED
@@ -39,13 +39,15 @@ module StaticMatic
|
|
39
39
|
@configuration = configuration
|
40
40
|
@current_page = nil
|
41
41
|
@current_file_stack = []
|
42
|
-
@base_dir = base_dir
|
42
|
+
@base_dir = File.expand_path(base_dir)
|
43
43
|
@src_dir = "#{@base_dir}/src"
|
44
44
|
@site_dir = "#{@base_dir}/site"
|
45
45
|
@templates_dir = File.dirname(__FILE__) + '/templates/default/'
|
46
|
+
|
46
47
|
@layout = "application"
|
47
48
|
@scope = Object.new
|
48
49
|
@scope.instance_variable_set("@staticmatic", self)
|
50
|
+
|
49
51
|
load_helpers
|
50
52
|
end
|
51
53
|
|
data/lib/staticmatic/helpers.rb
CHANGED
@@ -40,10 +40,16 @@ module StaticMatic
|
|
40
40
|
end
|
41
41
|
|
42
42
|
stylesheet_directories.each do |path|
|
43
|
+
|
43
44
|
filename_without_extension = File.basename(path).chomp(File.extname(path))
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
|
46
|
+
if !filename_without_extension.match(/^\_/)
|
47
|
+
relative_path = path.gsub(/#{@staticmatic.base_dir}\/(src|site)\//, "").
|
48
|
+
gsub(/#{filename_without_extension}\.(sass|css)/, "")
|
49
|
+
|
50
|
+
options[:href] = "#{relative_path}#{filename_without_extension}.css"
|
51
|
+
output << tag(:link, options)
|
52
|
+
end
|
47
53
|
end
|
48
54
|
else
|
49
55
|
#specific files requested and in a specific order
|
@@ -1,4 +1,4 @@
|
|
1
1
|
body
|
2
|
-
:
|
3
|
-
:
|
4
|
-
:
|
2
|
+
font:
|
3
|
+
family: Verdana
|
4
|
+
size: 10pt
|
data/lib/staticmatic.rb
CHANGED
data/spec/base_spec.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe "StaticMatic::Base" do
|
4
|
+
before do
|
5
|
+
setup_staticmatic
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should set initial configuration settings" do
|
9
|
+
@staticmatic.configuration.use_extensions_for_page_links.should == true
|
10
|
+
@staticmatic.configuration.preview_server_port.should == 3000
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe "Helpers:" do
|
4
|
+
include StaticMatic::Helpers
|
5
|
+
before do
|
6
|
+
setup_staticmatic
|
7
|
+
@staticmatic.instance_variable_set("@current_page", "")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should include custom helper" do
|
11
|
+
content = @staticmatic.generate_html_with_layout("index")
|
12
|
+
content.should match(/Hello, Steve!/)
|
13
|
+
end
|
14
|
+
|
15
|
+
context "When using the stylesheet helper" do
|
16
|
+
before do
|
17
|
+
@links = stylesheets
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should set up links for all stylesheets" do
|
21
|
+
@links.should match(/stylesheets\/application\.css/)
|
22
|
+
@links.should match(/stylesheets\/nested\/a_nested_stylesheet\.css/)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should not link to partials" do
|
26
|
+
@links.should_not match(/\_forms.css/)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/render_spec.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe "StaticMatic::Render" do
|
4
|
+
before do
|
5
|
+
setup_staticmatic
|
6
|
+
end
|
7
|
+
|
8
|
+
it "generate content with a layout" do
|
9
|
+
content = @staticmatic.generate_html_with_layout("index")
|
10
|
+
content.should match(/StaticMatic/)
|
11
|
+
content.should match(/This is some test content/)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "generate html with layout assigned in template" do
|
15
|
+
content = @staticmatic.generate_html_with_layout("layout_test")
|
16
|
+
content.should match(/Alternate Layout/)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "generate css" do
|
20
|
+
content = @staticmatic.generate_css("application")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "find source filename from path" do
|
24
|
+
@staticmatic.source_template_from_path("@base_dir/src/stylesheets/application.css")[1].should == "application"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "find layout from passed path" do
|
28
|
+
@staticmatic.determine_layout("test/projects").should == "projects"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/spec/rescue_spec.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe "StaticMatic::Rescue" do
|
4
|
+
before do
|
5
|
+
setup_staticmatic
|
6
|
+
end
|
7
|
+
|
8
|
+
it "catch haml template errors" do
|
9
|
+
output = @staticmatic.generate_html_with_layout("page_with_error")
|
10
|
+
output.should match(/StaticMatic::TemplateError/)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "catch sass template errors" do
|
14
|
+
output = @staticmatic.generate_css("css_with_error")
|
15
|
+
output.should match(/StaticMatic::TemplateError/)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "re-raise and catch partial errors" do
|
19
|
+
begin
|
20
|
+
@staticmatic.generate_html("page_with_partial_error")
|
21
|
+
rescue StaticMatic::TemplateError => template_error
|
22
|
+
template_error.filename.should match(/partials\/partial_with_error/)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "handle non-template errors" do
|
27
|
+
begin
|
28
|
+
raise Exception.new("This is an exception")
|
29
|
+
rescue Exception => e
|
30
|
+
output = @staticmatic.render_rescue_from_error(e)
|
31
|
+
end
|
32
|
+
|
33
|
+
output.should match(/Exception/)
|
34
|
+
output.should match(/This is an exception/)
|
35
|
+
end
|
36
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/server_spec.rb
ADDED
@@ -1,17 +1,17 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe "StaticMatic::Setup" do
|
4
|
+
before do
|
5
5
|
setup_staticmatic
|
6
6
|
end
|
7
7
|
|
8
|
-
|
8
|
+
it "setup directories" do
|
9
9
|
tmp_dir = File.dirname(__FILE__) + '/sandbox/tmp'
|
10
10
|
staticmatic = StaticMatic::Base.new(tmp_dir)
|
11
11
|
staticmatic.run('setup')
|
12
12
|
|
13
13
|
StaticMatic::Base.base_dirs.each do |dir|
|
14
|
-
|
14
|
+
File.exists?("#{tmp_dir}/#{dir}").should_not be_nil, "Should create #{dir}"
|
15
15
|
end
|
16
16
|
|
17
17
|
StaticMatic::Base.base_dirs.reverse.each do |dir|
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'stringio'
|
3
|
+
require 'spec'
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/../lib/staticmatic'
|
6
|
+
|
7
|
+
TEST_SITE_PATH = File.join(File.dirname(__FILE__), "sandbox", "test_site")
|
8
|
+
|
9
|
+
Spec::Runner.configure do |config|
|
10
|
+
end
|
11
|
+
|
12
|
+
def setup_staticmatic
|
13
|
+
@staticmatic = StaticMatic::Base.new(TEST_SITE_PATH)
|
14
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
describe "StaticMatic::Template" do
|
4
|
+
before do
|
5
5
|
setup_staticmatic
|
6
6
|
|
7
7
|
template_file = File.join(TEST_SITE_PATH, "src", "pages", "page_with_error.haml")
|
@@ -13,11 +13,11 @@ class StaticMatic::TemplateTest < Test::Unit::TestCase
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
16
|
+
it "extract source around line number" do
|
17
|
+
@template_error.source_extract.should match(/\- bang\!/)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
it "extract line number from backtrace" do
|
21
|
+
@template_error.line_number.should == "3"
|
22
22
|
end
|
23
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: staticmatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Bartholomew
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-05 00:00:00 +01:00
|
13
13
|
default_executable: staticmatic
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -65,38 +65,40 @@ files:
|
|
65
65
|
- lib/staticmatic/templates/default/index.haml
|
66
66
|
- lib/staticmatic/templates/rescues/default.haml
|
67
67
|
- lib/staticmatic/templates/rescues/template.haml
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
68
|
+
- spec/base_spec.rb
|
69
|
+
- spec/helpers_spec.rb
|
70
|
+
- spec/render_spec.rb
|
71
|
+
- spec/rescue_spec.rb
|
72
|
+
- spec/sandbox/test_site/configuration.rb
|
73
|
+
- spec/sandbox/test_site/site/index
|
74
|
+
- spec/sandbox/test_site/site/index.html
|
75
|
+
- spec/sandbox/test_site/site/layout_test
|
76
|
+
- spec/sandbox/test_site/site/page_with_error
|
77
|
+
- spec/sandbox/test_site/site/page_with_partial_error
|
78
|
+
- spec/sandbox/test_site/site/stylesheets/application.css
|
79
|
+
- spec/sandbox/test_site/site/sub_folder/another_sub_folder.
|
80
|
+
- spec/sandbox/test_site/site/sub_folder/another_sub_folder/index.html
|
81
|
+
- spec/sandbox/test_site/site/sub_folder/another_sub_folder/index.html.html
|
82
|
+
- spec/sandbox/test_site/site/sub_folder/index.html
|
83
|
+
- spec/sandbox/test_site/src/helpers/application_helper.rb
|
84
|
+
- spec/sandbox/test_site/src/layouts/alternate_layout.haml
|
85
|
+
- spec/sandbox/test_site/src/layouts/application.haml
|
86
|
+
- spec/sandbox/test_site/src/layouts/projects.haml
|
87
|
+
- spec/sandbox/test_site/src/pages/hello_world.erb
|
88
|
+
- spec/sandbox/test_site/src/pages/index.haml
|
89
|
+
- spec/sandbox/test_site/src/pages/layout_test.haml
|
90
|
+
- spec/sandbox/test_site/src/pages/page_with_error.haml
|
91
|
+
- spec/sandbox/test_site/src/pages/page_with_partial_error.haml
|
92
|
+
- spec/sandbox/test_site/src/partials/menu.haml
|
93
|
+
- spec/sandbox/test_site/src/partials/partial_with_error.haml
|
94
|
+
- spec/sandbox/test_site/src/stylesheets/application.sass
|
95
|
+
- spec/sandbox/test_site/src/stylesheets/css_with_error.sass
|
96
|
+
- spec/sandbox/test_site/src/stylesheets/nested/a_nested_stylesheet.sass
|
97
|
+
- spec/sandbox/test_site/src/stylesheets/partials/_forms.sass
|
98
|
+
- spec/server_spec.rb
|
99
|
+
- spec/setup_spec.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
- spec/template_error_spec.rb
|
100
102
|
has_rdoc: true
|
101
103
|
homepage: http://staticmatic.net
|
102
104
|
licenses: []
|
@@ -126,13 +128,13 @@ signing_key:
|
|
126
128
|
specification_version: 3
|
127
129
|
summary: Lightweight Static Site Framework
|
128
130
|
test_files:
|
129
|
-
-
|
130
|
-
-
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
137
|
-
-
|
138
|
-
-
|
131
|
+
- spec/base_spec.rb
|
132
|
+
- spec/helpers_spec.rb
|
133
|
+
- spec/render_spec.rb
|
134
|
+
- spec/rescue_spec.rb
|
135
|
+
- spec/sandbox/test_site/configuration.rb
|
136
|
+
- spec/sandbox/test_site/src/helpers/application_helper.rb
|
137
|
+
- spec/server_spec.rb
|
138
|
+
- spec/setup_spec.rb
|
139
|
+
- spec/spec_helper.rb
|
140
|
+
- spec/template_error_spec.rb
|
data/test/base_test.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/test_helper"
|
2
|
-
|
3
|
-
class StaticMatic::BaseTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
setup_staticmatic
|
6
|
-
end
|
7
|
-
|
8
|
-
should "set initial configuration settings" do
|
9
|
-
assert_equal true, @staticmatic.configuration.use_extensions_for_page_links
|
10
|
-
assert_equal 3000, @staticmatic.configuration.preview_server_port
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
data/test/helpers_test.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/test_helper"
|
2
|
-
|
3
|
-
class StaticMatic::HelpersTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
setup_staticmatic
|
6
|
-
end
|
7
|
-
|
8
|
-
should "include custom helper" do
|
9
|
-
content = @staticmatic.generate_html_with_layout("index")
|
10
|
-
assert_match "Hello, Steve!", content
|
11
|
-
end
|
12
|
-
end
|
data/test/render_test.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/test_helper"
|
2
|
-
|
3
|
-
class StaticMatic::RenderTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
setup_staticmatic
|
6
|
-
end
|
7
|
-
|
8
|
-
should "generate content with a layout" do
|
9
|
-
content = @staticmatic.generate_html_with_layout("index")
|
10
|
-
assert_match "StaticMatic", content
|
11
|
-
assert_match "This is some test content", content
|
12
|
-
end
|
13
|
-
|
14
|
-
should "generate html with layout assigned in template" do
|
15
|
-
content = @staticmatic.generate_html_with_layout("layout_test")
|
16
|
-
assert_match "Alternate Layout", content
|
17
|
-
end
|
18
|
-
|
19
|
-
should "generate css" do
|
20
|
-
content = @staticmatic.generate_css("application")
|
21
|
-
end
|
22
|
-
|
23
|
-
should "find source filename from path" do
|
24
|
-
assert_equal "application", @staticmatic.source_template_from_path("@base_dir/src/stylesheets/application.css")[1]
|
25
|
-
end
|
26
|
-
|
27
|
-
should "find layout from passed path" do
|
28
|
-
assert_equal "projects", @staticmatic.determine_layout("test/projects")
|
29
|
-
end
|
30
|
-
end
|
data/test/rescue_test.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/test_helper"
|
2
|
-
|
3
|
-
class StaticMatic::RescueTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
setup_staticmatic
|
6
|
-
end
|
7
|
-
|
8
|
-
should "catch haml template errors" do
|
9
|
-
output = @staticmatic.generate_html_with_layout("page_with_error")
|
10
|
-
assert_match /StaticMatic::TemplateError/, output
|
11
|
-
end
|
12
|
-
|
13
|
-
should "catch sass template errors" do
|
14
|
-
output = @staticmatic.generate_css("css_with_error")
|
15
|
-
assert_match /StaticMatic::TemplateError/, output
|
16
|
-
end
|
17
|
-
|
18
|
-
should "re-raise and catch partial errors" do
|
19
|
-
begin
|
20
|
-
@staticmatic.generate_html("page_with_partial_error")
|
21
|
-
rescue StaticMatic::TemplateError => template_error
|
22
|
-
assert_match /partials\/partial_with_error/, template_error.filename
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
should "handle non-template errors" do
|
27
|
-
begin
|
28
|
-
raise Exception.new("This is an exception")
|
29
|
-
rescue Exception => e
|
30
|
-
output = @staticmatic.render_rescue_from_error(e)
|
31
|
-
end
|
32
|
-
|
33
|
-
assert_match /Exception/, output
|
34
|
-
assert_match /This is an exception/, output
|
35
|
-
end
|
36
|
-
end
|
data/test/server_test.rb
DELETED
data/test/test_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'stringio'
|
3
|
-
require 'test/unit'
|
4
|
-
|
5
|
-
require File.dirname(__FILE__) + '/../lib/staticmatic'
|
6
|
-
|
7
|
-
TEST_SITE_PATH = File.join(File.dirname(__FILE__), "sandbox", "test_site")
|
8
|
-
|
9
|
-
class Test::Unit::TestCase
|
10
|
-
def self.should(description, &block)
|
11
|
-
test_name = "test_should_#{description.gsub(/[\s]/,'_')}".to_sym
|
12
|
-
raise "#{test_name} is already defined in #{self}" if self.instance_methods.include?(test_name.to_s)
|
13
|
-
define_method(test_name, &block)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup_staticmatic
|
18
|
-
@staticmatic = StaticMatic::Base.new(TEST_SITE_PATH)
|
19
|
-
end
|
20
|
-
|