awestruct 0.5.6.beta8 → 0.5.6.beta9
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.
- checksums.yaml +4 -4
- data/Gemfile +2 -4
- data/Rakefile +1 -1
- data/awestruct.gemspec +22 -18
- data/lib/awestruct/cli/auto.rb +25 -21
- data/lib/awestruct/cli/generate.rb +3 -2
- data/lib/awestruct/cli/init.rb +2 -1
- data/lib/awestruct/cli/invoker.rb +4 -3
- data/lib/awestruct/cli/manifest.rb +41 -0
- data/lib/awestruct/cli/options.rb +10 -1
- data/lib/awestruct/cli/server.rb +36 -6
- data/lib/awestruct/config/default-site.yml +3 -0
- data/lib/awestruct/context.rb +17 -0
- data/lib/awestruct/context_helper.rb +25 -21
- data/lib/awestruct/deploy/s3_deploy.rb +41 -3
- data/lib/awestruct/engine.rb +64 -33
- data/lib/awestruct/extensions/disqus.rb +2 -2
- data/lib/awestruct/extensions/flattr.rb +1 -1
- data/lib/awestruct/extensions/pipeline.rb +30 -8
- data/lib/awestruct/extensions/relative.rb +3 -1
- data/lib/awestruct/extensions/sitemap.rb +6 -0
- data/lib/awestruct/extensions/sitemap.xml.haml +2 -1
- data/lib/awestruct/extensions/tagger.rb +7 -6
- data/lib/awestruct/extensions/template.atom.haml +1 -1
- data/lib/awestruct/frameworks/base_Gemfile +12 -1
- data/lib/awestruct/frameworks/bootstrap/base_index.html.haml +22 -20
- data/lib/awestruct/frameworks/bootstrap/base_layout.html.haml +9 -7
- data/lib/awestruct/handlers/asciidoctor_handler.rb +1 -1
- data/lib/awestruct/handlers/base_tilt_handler.rb +3 -1
- data/lib/awestruct/pipeline.rb +57 -7
- data/lib/awestruct/rack/generate.rb +43 -0
- data/lib/awestruct/util/exception_helper.rb +3 -0
- data/lib/awestruct/version.rb +1 -1
- data/spec/awestruct/cli/invoker_spec.rb +1 -1
- data/spec/awestruct/cli/options_spec.rb +14 -13
- data/spec/awestruct/cli/server_spec.rb +15 -0
- data/spec/awestruct/context_helper_spec.rb +5 -5
- data/spec/awestruct/engine_spec.rb +110 -1
- data/spec/awestruct/extensions/relative_spec.rb +22 -0
- data/spec/awestruct/handlers/asciidoc_handler_spec.rb +7 -1
- data/spec/awestruct/handlers/layout_handler_spec.rb +7 -7
- data/spec/awestruct/handlers/tilt_handler_spec.rb +1 -1
- data/spec/awestruct/pipeline_spec.rb +27 -2
- data/spec/awestruct/scm/git_spec.rb +4 -4
- data/spec/spec_helper.rb +6 -1
- data/spec/support/emmet_matchers.rb +1 -1
- data/spec/support/nokogiri_matchers.rb +1 -1
- data/spec/support/shared_handler_example.rb +66 -71
- data/spec/support/test-data/engine-generate-no-errors/_config/site.yml +26 -0
- data/spec/support/test-data/engine-generate-no-errors/_ext/pipeline.rb +8 -0
- data/spec/support/test-data/engine-generate-no-errors/_layouts/base.html.slim +6 -0
- data/spec/support/test-data/engine-generate-no-errors/index.html.slim +5 -0
- data/spec/support/test-data/engine-generate-with-errors/_config/site.yml +26 -0
- data/spec/support/test-data/engine-generate-with-errors/_ext/pipeline.rb +8 -0
- data/spec/support/test-data/engine-generate-with-errors/_layouts/base.html.slim +6 -0
- data/spec/support/test-data/engine-generate-with-errors/index.html.slim +6 -0
- data/spec/support/test-data/engine-yaml/_config/site.yml +9 -0
- data/spec/support/test-data/pipeline/_ext/extensions.rb +26 -0
- data/spec/support/test-data/pipeline/_ext/pipeline.rb +12 -0
- metadata +229 -72
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'awestruct/cli/options'
|
2
2
|
require 'awestruct/engine'
|
3
|
+
require 'logger'
|
3
4
|
|
4
5
|
require 'hashery/open_cascade'
|
5
6
|
|
@@ -68,6 +69,18 @@ describe Awestruct::Engine do
|
|
68
69
|
engine.site.intl_name.should == "Intern\u00e9\u0161nl"
|
69
70
|
end
|
70
71
|
|
72
|
+
it "should be able to handle erb in site.yaml" do
|
73
|
+
opts = Awestruct::CLI::Options.new
|
74
|
+
opts.source_dir = test_data_dir 'engine-yaml'
|
75
|
+
config = Awestruct::Config.new( opts )
|
76
|
+
|
77
|
+
engine = Awestruct::Engine.new(config)
|
78
|
+
engine.load_default_site_yaml
|
79
|
+
engine.load_user_site_yaml( 'development' )
|
80
|
+
engine.site.date.should be_a Date
|
81
|
+
engine.site.date.iso8601.should eql '2015-04-13'
|
82
|
+
end
|
83
|
+
|
71
84
|
|
72
85
|
it "should be able to load arbitrary _config/*.yml files" do
|
73
86
|
opts = Awestruct::CLI::Options.new
|
@@ -119,7 +132,103 @@ describe Awestruct::Engine do
|
|
119
132
|
expect( Compass.configuration.output_style ).to eq :expanded
|
120
133
|
end
|
121
134
|
|
122
|
-
it "
|
135
|
+
it "should cleanly generate page output, using threads" do
|
136
|
+
output_dir = Dir.mktmpdir 'engine-generate-no-errors'
|
137
|
+
|
138
|
+
begin
|
139
|
+
log = StringIO.new
|
140
|
+
$LOG = Logger.new(log)
|
141
|
+
$LOG.level = Logger::DEBUG
|
142
|
+
|
143
|
+
opts = Awestruct::CLI::Options.new
|
144
|
+
opts.source_dir = test_data_dir 'engine-generate-no-errors'
|
145
|
+
opts.output_dir = output_dir
|
146
|
+
config = Awestruct::Config.new( opts )
|
147
|
+
engine = Awestruct::Engine.new(config)
|
148
|
+
begin
|
149
|
+
engine.run('development', 'http://localhost:4242', 'http://localhost:4242')
|
150
|
+
rescue SystemExit => e
|
151
|
+
e.status.should eql 0
|
152
|
+
end
|
153
|
+
ensure
|
154
|
+
FileUtils.remove_entry_secure output_dir
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should cleanly generate page output, using processes" do
|
159
|
+
output_dir = Dir.mktmpdir 'engine-generate-no-errors'
|
160
|
+
|
161
|
+
begin
|
162
|
+
log = StringIO.new
|
163
|
+
$LOG = Logger.new(log)
|
164
|
+
$LOG.level = Logger::DEBUG
|
165
|
+
|
166
|
+
opts = Awestruct::CLI::Options.new
|
167
|
+
opts.source_dir = test_data_dir 'engine-generate-no-errors'
|
168
|
+
opts.output_dir = output_dir
|
169
|
+
config = Awestruct::Config.new( opts )
|
170
|
+
engine = Awestruct::Engine.new(config)
|
171
|
+
engine.site.generation = [:in_processes => 2]
|
172
|
+
begin
|
173
|
+
engine.run('development', 'http://localhost:4242', 'http://localhost:4242')
|
174
|
+
rescue SystemExit => e
|
175
|
+
e.status.should eql 0
|
176
|
+
end
|
177
|
+
ensure
|
178
|
+
FileUtils.remove_entry_secure output_dir
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should exit unsuccessfully if generate page output fails, using threads" do
|
183
|
+
output_dir = Dir.mktmpdir 'engine-generate-with-errors'
|
184
|
+
|
185
|
+
begin
|
186
|
+
log = StringIO.new
|
187
|
+
$LOG = Logger.new(log)
|
188
|
+
$LOG.level = Logger::DEBUG
|
189
|
+
|
190
|
+
opts = Awestruct::CLI::Options.new
|
191
|
+
opts.source_dir = test_data_dir 'engine-generate-with-errors'
|
192
|
+
opts.output_dir = output_dir
|
193
|
+
config = Awestruct::Config.new( opts )
|
194
|
+
engine = Awestruct::Engine.new(config)
|
195
|
+
begin
|
196
|
+
engine.run('development', 'http://localhost:4242', 'http://localhost:4242')
|
197
|
+
fail('Expected generation error')
|
198
|
+
rescue SystemExit => e
|
199
|
+
e.status.should eql Awestruct::ExceptionHelper::EXITCODES[:generation_error]
|
200
|
+
end
|
201
|
+
ensure
|
202
|
+
FileUtils.remove_entry_secure output_dir, true
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should exit unsuccessfully if generate page output fails, using processes" do
|
207
|
+
output_dir = Dir.mktmpdir 'engine-generate-with-errors'
|
208
|
+
|
209
|
+
begin
|
210
|
+
log = StringIO.new
|
211
|
+
$LOG = Logger.new(log)
|
212
|
+
$LOG.level = Logger::DEBUG
|
213
|
+
|
214
|
+
opts = Awestruct::CLI::Options.new
|
215
|
+
opts.source_dir = test_data_dir 'engine-generate-with-errors'
|
216
|
+
opts.output_dir = output_dir
|
217
|
+
config = Awestruct::Config.new( opts )
|
218
|
+
engine = Awestruct::Engine.new(config)
|
219
|
+
engine.site.generation = [:in_processes => 2]
|
220
|
+
begin
|
221
|
+
engine.run('development', 'http://localhost:4242', 'http://localhost:4242')
|
222
|
+
fail('Expected generation error')
|
223
|
+
rescue SystemExit => e
|
224
|
+
e.status.should eql Awestruct::ExceptionHelper::EXITCODES[:generation_error]
|
225
|
+
end
|
226
|
+
ensure
|
227
|
+
FileUtils.remove_entry_secure output_dir, true
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should accept site.compass_line_comments and site.compass_output_style to configure behavior" do
|
123
232
|
opts = Awestruct::CLI::Options.new
|
124
233
|
opts.source_dir = test_data_dir 'engine'
|
125
234
|
config = Awestruct::Config.new( opts )
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'awestruct/extensions/relative'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
describe Awestruct::Extensions::Relative do
|
5
|
+
let(:dummy_class) { Class.new { extend Awestruct::Extensions::Relative } }
|
6
|
+
|
7
|
+
context 'with file extension' do
|
8
|
+
let (:page) { OpenStruct.new(:output_path => 'site/base/path/file.html') }
|
9
|
+
|
10
|
+
it "should should not have '/' at the end if there is a file extension" do
|
11
|
+
expect(dummy_class.relative('site/base/path/another_file.html', page)).to eql 'another_file.html'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'without file extension' do
|
16
|
+
let (:page) { OpenStruct.new(:output_path => 'site/base/path/file.html') }
|
17
|
+
|
18
|
+
it "should should not have '/' at the end if there is a file extension" do
|
19
|
+
expect(dummy_class.relative('site/base/path/some_directory', page)).to eql 'some_directory/'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'rspec/matchers.rb'
|
3
|
+
require 'tilt'
|
3
4
|
|
4
5
|
verify = lambda { |output|
|
5
6
|
include EmmetMatchers
|
6
7
|
# clean whitespace to make comparison easier
|
7
|
-
output.should have_structure('div
|
8
|
+
output.should have_structure('div.paragraph>p>strong')
|
8
9
|
}
|
9
10
|
|
10
11
|
verify_front_matter = lambda { |output, page|
|
@@ -121,4 +122,9 @@ describe Awestruct::Handlers::AsciidoctorHandler do
|
|
121
122
|
end
|
122
123
|
|
123
124
|
it_should_behave_like 'a handler', theories
|
125
|
+
|
126
|
+
it 'should be registered as our implementation for tilt' do
|
127
|
+
puts ::Tilt.default_mapping['adoc']
|
128
|
+
::Tilt.default_mapping['adoc'].should eql ::Awestruct::Tilt::AsciidoctorTemplate
|
129
|
+
end
|
124
130
|
end
|
@@ -19,21 +19,21 @@ describe Awestruct::Handlers::LayoutHandler do
|
|
19
19
|
@site = Awestruct::Site.new( @engine, @config )
|
20
20
|
layout_loader = Awestruct::PageLoader.new( @site, :layouts )
|
21
21
|
layout = layout_loader.load_page( File.join( @config.dir, 'haml-layout.html.haml' ) )
|
22
|
-
layout.class.
|
23
|
-
layout.
|
22
|
+
expect(layout.class).to eql Awestruct::Page
|
23
|
+
expect(layout).to_not be_nil
|
24
24
|
|
25
25
|
@site.layouts << layout
|
26
26
|
|
27
27
|
layout = layout_loader.load_page( File.join( @config.dir, 'haml-layout-two.html.haml' ) )
|
28
|
-
layout.class.
|
29
|
-
layout.
|
28
|
+
expect(layout.class).to eql Awestruct::Page
|
29
|
+
expect(layout).to_not be_nil
|
30
30
|
|
31
31
|
@site.layouts << layout
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should be able to find layouts by simple name" do
|
35
35
|
layout = @site.layouts.find_matching( 'haml-layout', '.html' )
|
36
|
-
layout.class.
|
36
|
+
expect(layout.class).to eql Awestruct::Page
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should apply the layout to its delegate's content" do
|
@@ -45,7 +45,7 @@ describe Awestruct::Handlers::LayoutHandler do
|
|
45
45
|
context = page.create_context
|
46
46
|
context.page.layout = 'haml-layout'
|
47
47
|
|
48
|
-
@site.layouts.find_matching( 'haml-layout', '.html' ).
|
48
|
+
expect(@site.layouts.find_matching( 'haml-layout', '.html' )).to_not be_nil
|
49
49
|
rendered = layout_handler.rendered_content( context )
|
50
50
|
|
51
51
|
end
|
@@ -59,7 +59,7 @@ describe Awestruct::Handlers::LayoutHandler do
|
|
59
59
|
|
60
60
|
context = page.create_context
|
61
61
|
|
62
|
-
@site.layouts.find_matching('haml-layout', '.html').
|
62
|
+
expect(@site.layouts.find_matching('haml-layout', '.html')).to_not be_nil
|
63
63
|
rendered = layout_handler.rendered_content( context )
|
64
64
|
|
65
65
|
haml_index = ( rendered =~ %r(This is a haml layout) )
|
@@ -115,7 +115,7 @@ describe Awestruct::Handlers::TiltHandler do
|
|
115
115
|
$LOG.level = Logger::DEBUG
|
116
116
|
@site.dir = Pathname.new( test_data_dir 'handlers' )
|
117
117
|
path = handler_file( "hello.bogus" )
|
118
|
-
expect(Awestruct::Handlers::TiltMatcher.new().match(path)).to
|
118
|
+
expect(Awestruct::Handlers::TiltMatcher.new().match(path)).to be_falsey
|
119
119
|
expect(log.string).to include('Copying')
|
120
120
|
|
121
121
|
# we don't even want to process a file if we cannot load its Tilt template
|
@@ -1,8 +1,33 @@
|
|
1
|
+
require 'awestruct/engine'
|
2
|
+
require 'awestruct/pipeline'
|
1
3
|
|
2
|
-
|
4
|
+
describe Awestruct::Pipeline do
|
5
|
+
before do
|
6
|
+
dir = Pathname.new( test_data_dir 'pipeline' )
|
7
|
+
opts = Awestruct::CLI::Options.new
|
8
|
+
opts.source_dir = dir
|
3
9
|
|
10
|
+
@site = Hashery::OpenCascade[ { :encoding=>false, :dir=>dir, :config=>Awestruct::Config.new( opts ), :pages => [] } ]
|
11
|
+
@engine = Awestruct::Engine.new(@site.config)
|
4
12
|
|
5
|
-
|
13
|
+
log = StringIO.new
|
14
|
+
$LOG = Logger.new(log)
|
15
|
+
$LOG.level = Logger::DEBUG
|
16
|
+
|
17
|
+
@engine.load_pipeline
|
18
|
+
@pipeline = @engine.pipeline
|
19
|
+
end
|
20
|
+
|
21
|
+
context "after pipeline is loaded" do
|
22
|
+
specify "should have all specified extension points" do
|
23
|
+
expect(@pipeline.before_all_extensions.size).to eql 1
|
24
|
+
expect(@pipeline.extensions.size).to eql 1
|
25
|
+
expect(@pipeline.after_all_extensions.size).to eql 1
|
26
|
+
expect(@pipeline.helpers.size).to eql 1
|
27
|
+
expect(@pipeline.transformers.size).to eql 1
|
28
|
+
expect(@pipeline.after_generation_extensions.size).to eql 1
|
29
|
+
end
|
30
|
+
end
|
6
31
|
|
7
32
|
it "should provide a way to find a matching handler chain for a given path" do
|
8
33
|
pipeline = Awestruct::Pipeline.new
|
@@ -8,22 +8,22 @@ describe Awestruct::Scm::Git do
|
|
8
8
|
context "#uncommitted_changes?('.')" do
|
9
9
|
specify 'when there are no changes, returns false' do
|
10
10
|
Open3.should_receive(:popen3).with('git status --porcelain', :chdir => '.').and_yield(nil, StringIO.new(''), StringIO.new(''), nil)
|
11
|
-
expect(subject.uncommitted_changes? '.').to
|
11
|
+
expect(subject.uncommitted_changes? '.').to be_falsey
|
12
12
|
end
|
13
13
|
|
14
14
|
specify 'when there are changes to untracked files, returns true' do
|
15
15
|
Open3.should_receive(:popen3).with('git status --porcelain', :chdir => '.').and_yield(nil, StringIO.new('?? test.rb'), StringIO.new(''), nil)
|
16
|
-
expect(subject.uncommitted_changes? '.').to
|
16
|
+
expect(subject.uncommitted_changes? '.').to be_truthy
|
17
17
|
end
|
18
18
|
|
19
19
|
specify 'when there are modifications, returns true' do
|
20
20
|
Open3.should_receive(:popen3).with('git status --porcelain', :chdir => '.').and_yield(nil, StringIO.new(' M test.rb'), StringIO.new(''), nil)
|
21
|
-
expect(subject.uncommitted_changes? '.').to
|
21
|
+
expect(subject.uncommitted_changes? '.').to be_truthy
|
22
22
|
end
|
23
23
|
|
24
24
|
specify 'when there are additions and modifications, returns true' do
|
25
25
|
Open3.should_receive(:popen3).with('git status --porcelain', :chdir => '.').and_yield(nil, StringIO.new('AM test.rb'), StringIO.new(''), nil)
|
26
|
-
expect(subject.uncommitted_changes? '.').to
|
26
|
+
expect(subject.uncommitted_changes? '.').to be_truthy
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rspec'
|
3
|
+
require 'simplecov'
|
4
|
+
|
5
|
+
SimpleCov.start
|
3
6
|
|
4
7
|
Dir["./spec/support/**/*.rb"].each {|f| require f}
|
5
8
|
|
6
9
|
RSpec.configure do |config|
|
7
|
-
config.
|
10
|
+
config.mock_with :rspec do |mocks|
|
11
|
+
mocks.verify_doubled_constant_names = true
|
12
|
+
end
|
8
13
|
end
|
@@ -7,103 +7,98 @@ require 'hashery'
|
|
7
7
|
REQUIRED_VARIABLES = [:page, :simple_name, :syntax, :extension]
|
8
8
|
ALL_VARIABLES = REQUIRED_VARIABLES + [:format, :matcher, :unless, :site_overrides]
|
9
9
|
|
10
|
-
|
10
|
+
shared_examples_for 'a handler' do |theories|
|
11
11
|
|
12
12
|
def handler_file(path)
|
13
13
|
"#{@site.config.dir}/#{path}"
|
14
14
|
end
|
15
15
|
|
16
16
|
def create_context
|
17
|
-
Hashery::OpenCascade[{
|
17
|
+
Hashery::OpenCascade[{:site => @site}]
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
before :each do
|
21
|
+
@engine = init
|
22
|
+
@site = @engine.site
|
23
|
+
end
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
def init
|
26
|
+
opts = Awestruct::CLI::Options.new
|
27
|
+
opts.source_dir = test_data_dir 'handlers'
|
28
|
+
config = Awestruct::Config.new(opts)
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
engine = Awestruct::Engine.new(config)
|
31
|
+
engine.load_default_site_yaml
|
32
|
+
engine
|
33
|
+
end
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
35
|
+
def create_handler(page)
|
36
|
+
@engine.load_page File.join(@engine.config.dir, page)
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
def merge_site_overrides(overrides)
|
40
|
+
@site.update overrides
|
41
|
+
end
|
40
42
|
|
41
|
-
|
42
|
-
@site.update overrides
|
43
|
-
end
|
43
|
+
theories.each do |theory|
|
44
44
|
|
45
|
-
|
45
|
+
# Validate input
|
46
|
+
missing = []
|
47
|
+
REQUIRED_VARIABLES.each do |key|
|
48
|
+
missing << key unless theory.has_key? key
|
49
|
+
end
|
50
|
+
raise "Missing required variable(s) '#{missing.join(', ')}'. Requires all '#{REQUIRED_VARIABLES.join(', ')}'" if missing.size > 0
|
46
51
|
|
47
|
-
|
48
|
-
|
49
|
-
REQUIRED_VARIABLES.each do |key|
|
50
|
-
missing << key unless theory.has_key? key
|
51
|
-
end
|
52
|
-
raise "Missing required variable(s) '#{missing.join(', ')}'. Requires all '#{REQUIRED_VARIABLES.join(', ')}'" if missing.size > 0
|
52
|
+
unknown = theory.keys-ALL_VARIABLES
|
53
|
+
raise "Unknown theory variable(s) '#{unknown.join(', ')}'. Supported variables '#{ALL_VARIABLES.join(', ')}'" if unknown.size > 0
|
53
54
|
|
54
|
-
|
55
|
-
raise "Unknown theory variable(s) '#{unknown.join(', ')}'. Supported variables '#{ALL_VARIABLES.join(', ')}'" if unknown.size > 0
|
55
|
+
# Prove the theory
|
56
56
|
|
57
|
-
|
57
|
+
it "should provide simple name '#{theory[:simple_name]}' for page '#{theory[:page]}'" do
|
58
|
+
handler = create_handler theory[:page]
|
59
|
+
expect(handler.simple_name).to eql theory[:simple_name]
|
60
|
+
end
|
58
61
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
62
|
+
it "should provide content syntax '#{theory[:syntax]}' for page '#{theory[:page]}'" do
|
63
|
+
handler = create_handler theory[:page]
|
64
|
+
expect(handler.content_syntax).to eql theory[:syntax]
|
65
|
+
end
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
67
|
+
it "should provide output extension '#{theory[:extension]}' for page '#{theory[:page]}'" do
|
68
|
+
handler = create_handler theory[:page]
|
69
|
+
expect(handler.output_extension).to eql theory[:extension]
|
70
|
+
end
|
68
71
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
+
unless theory[:format].nil?
|
73
|
+
it "should set the engine format '#{theory[:format]}' for page '#{theory[:page]}'" do
|
74
|
+
page = create_handler theory[:page]
|
75
|
+
handler = page.handler
|
76
|
+
begin
|
77
|
+
handler = handler.delegate
|
78
|
+
end while handler.delegate and !handler.kind_of?(Awestruct::Handlers::TiltHandler)
|
79
|
+
expect(handler).to_not be_nil
|
80
|
+
expect(handler.options[:format]).to eql theory[:format]
|
72
81
|
end
|
82
|
+
end
|
73
83
|
|
74
|
-
|
75
|
-
it "should set the engine format '#{theory[:format]}' for page '#{theory[:page]}'" do
|
76
|
-
page = create_handler theory[:page]
|
77
|
-
handler = page.handler
|
78
|
-
begin
|
79
|
-
handler = handler.delegate
|
80
|
-
end while handler.delegate and !handler.kind_of?(Awestruct::Handlers::TiltHandler)
|
81
|
-
handler.should_not be_nil
|
82
|
-
handler.options[:format].should == theory[:format]
|
83
|
-
end
|
84
|
-
end
|
84
|
+
unless theory[:matcher].nil?
|
85
85
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
if theory.has_key? :site_overrides
|
91
|
-
merge_site_overrides(theory[:site_overrides])
|
92
|
-
end
|
93
|
-
handler = create_handler theory[:page]
|
94
|
-
handler.update(additional_config_page) { |k, oldval, newval| oldval } if respond_to?('additional_config_page')
|
95
|
-
output = handler.rendered_content(handler.create_context)
|
96
|
-
output.should_not be_nil
|
97
|
-
|
98
|
-
theory[:matcher].call(output, handler) if theory[:matcher].arity == 2
|
99
|
-
theory[:matcher].call(output) if theory[:matcher].arity == 1
|
100
|
-
else
|
101
|
-
pending theory[:unless][:message]
|
86
|
+
it "should render page '#{theory[:page]}'" do
|
87
|
+
if theory[:unless].nil? or !theory[:unless][:exp].call()
|
88
|
+
if theory.has_key? :site_overrides
|
89
|
+
merge_site_overrides(theory[:site_overrides])
|
102
90
|
end
|
91
|
+
handler = create_handler theory[:page]
|
92
|
+
handler.update(additional_config_page) { |k, oldval, newval| oldval } if respond_to?('additional_config_page')
|
93
|
+
output = handler.rendered_content(handler.create_context)
|
94
|
+
expect(output).to_not be_nil
|
95
|
+
|
96
|
+
theory[:matcher].call(output, handler) if theory[:matcher].arity == 2
|
97
|
+
theory[:matcher].call(output) if theory[:matcher].arity == 1
|
98
|
+
else
|
99
|
+
pending theory[:unless][:message]
|
103
100
|
end
|
104
|
-
|
105
101
|
end
|
106
|
-
|
107
102
|
end
|
108
103
|
end
|
109
104
|
end
|