rename old padrino tests, remove sinatra tests, use metadata hooks for frontmatter and liquid

This commit is contained in:
Thomas Reynolds 2011-11-18 13:38:18 -08:00
parent c82a40dde5
commit 0e5ce50787
13 changed files with 117 additions and 156 deletions

View file

@ -3,7 +3,7 @@ Feature: Built-in macro view helpers
Scenario: Using the link_to helper
Given the Server is running at "test-app"
When I go to "/padrino_test.html"
When I go to "/former_padrino_test.html"
And I should see 'href="test2.com"'
And I should see 'src="/images/test2.png"'
Then I should see 'src="/javascripts/test1.js"'

View file

@ -1,6 +0,0 @@
Feature: Sinatra Routes
Scenario: Rendering html
Given the Server is running at "test-app"
When I go to "/sinatra_test"
Then I should see "Ratpack"

View file

@ -1,8 +1,9 @@
Given /^I am using an asset host$/ do
@server ||= Middleman.server
@server.set :show_exceptions, false
@server.activate :asset_host
@server.set :asset_host do |asset|
"http://assets%d.example.com" % (asset.hash % 4)
end
@initialize_commands ||= []
@initialize_commands << lambda {
activate :asset_host
set :asset_host do |asset|
"http://assets%d.example.com" % (asset.hash % 4)
end
}
end

View file

@ -1,23 +1,18 @@
Given /^a clean server$/ do
@server = Middleman.server
@server.set :show_exceptions, false
@initialize_commands = []
end
Given /^"([^\"]*)" feature is "([^\"]*)"$/ do |feature, state|
@server = Middleman.server
@server.set :show_exceptions, false
@initialize_commands ||= []
if state == "enabled"
@server.activate(feature.to_sym)
end
@server.set :environment, @current_env || :development
@initialize_commands << lambda { activate(feature.to_sym) }
end
end
Given /^"([^\"]*)" is set to "([^\"]*)"$/ do |variable, value|
@server ||= Middleman.server
@server.set :show_exceptions, false
@server.set variable.to_sym, value
@initialize_commands ||= []
@initialize_commands << lambda { set(variable.to_sym, value) }
end
Given /^current environment is "([^\"]*)"$/ do |env|
@ -25,13 +20,22 @@ Given /^current environment is "([^\"]*)"$/ do |env|
end
Given /^the Server is running at "([^\"]*)"$/ do |app_path|
@server ||= Middleman.server
@server.set :show_exceptions, false
root = File.dirname(File.dirname(File.dirname(__FILE__)))
@server.set :root, File.join(root, "fixtures", app_path)
@app = @server.new!
app_rack = @server.build_new(@app)
@browser = Rack::Test::Session.new(Rack::MockSession.new(app_rack))
root_dir = File.dirname(File.dirname(File.dirname(__FILE__)))
initialize_commands = @initialize_commands || []
initialize_commands.unshift lambda {
set :root, File.join(root_dir, "fixtures", app_path)
set :environment, @current_env || :development
}
@server_inst = Middleman.server.inst do
initialize_commands.each do |p|
instance_exec(&p)
end
end
app_rack = @server_inst.class.to_rack_app
@browser = ::Rack::Test::Session.new(::Rack::MockSession.new(app_rack))
end
When /^I go to "([^\"]*)"$/ do |url|

View file

@ -1,13 +1,15 @@
Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout|
@server ||= Middleman.server
@server.set :show_exceptions, false
@server.page(url, :layout => layout.to_sym)
@initialize_commands ||= []
@initialize_commands << lambda {
page(url, :layout => layout.to_sym)
}
end
Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout|
@server ||= Middleman.server
@server.set :show_exceptions, false
@server.with_layout(layout.to_sym) do
page(url)
end
@initialize_commands ||= []
@initialize_commands << lambda {
with_layout(layout.to_sym) do
page(url)
end
}
end