add test for helpers in external files
This commit is contained in:
parent
6aac51f6f0
commit
9b07bf24dd
5 changed files with 19 additions and 0 deletions
6
features/helpers_external.feature
Normal file
6
features/helpers_external.feature
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Feature: Helpers in external files
|
||||||
|
|
||||||
|
Scenario: Hello Helper
|
||||||
|
Given the Server is running at "external-helpers"
|
||||||
|
Then going to "/index.html" should not raise an exception
|
||||||
|
And I should see "Hello World"
|
4
fixtures/external-helpers/config.rb
Normal file
4
fixtures/external-helpers/config.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
require "lib/hello_helper"
|
||||||
|
helpers HelloHelper
|
||||||
|
|
||||||
|
page "/", :layout => false
|
5
fixtures/external-helpers/lib/hello_helper.rb
Normal file
5
fixtures/external-helpers/lib/hello_helper.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module HelloHelper
|
||||||
|
def hello
|
||||||
|
"Hello World"
|
||||||
|
end
|
||||||
|
end
|
1
fixtures/external-helpers/source/index.html.erb
Normal file
1
fixtures/external-helpers/source/index.html.erb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<%= hello %>
|
|
@ -94,6 +94,9 @@ module Middleman::CoreExtensions::Extensions
|
||||||
|
|
||||||
run_hook :before_configuration
|
run_hook :before_configuration
|
||||||
|
|
||||||
|
# Search the root of the project for required files
|
||||||
|
$LOAD_PATH.unshift(root)
|
||||||
|
|
||||||
# Check for and evaluate local configuration
|
# Check for and evaluate local configuration
|
||||||
local_config = File.join(root, "config.rb")
|
local_config = File.join(root, "config.rb")
|
||||||
if File.exists? local_config
|
if File.exists? local_config
|
||||||
|
|
Loading…
Reference in a new issue