1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

Data API test

This commit is contained in:
Thomas Reynolds 2011-07-06 10:29:07 -07:00
parent c9e4d41533
commit 6a3de0768c
5 changed files with 17 additions and 4 deletions

7
features/data.feature Normal file
View file

@ -0,0 +1,7 @@
Feature: Local Data API
In order to abstract content from structure
Scenario: Rendering html with the feature enabled
Given the Server is running
When I go to "/data.html"
Then I should see "One:Two"

View file

@ -3,6 +3,7 @@ with_layout false do
page "/inline-js.html" page "/inline-js.html"
page "/inline-coffeescript.html" page "/inline-coffeescript.html"
page "/slim.html" page "/slim.html"
page "/data.html"
end end
get "/page-class.html" do get "/page-class.html" do

View file

@ -0,0 +1,4 @@
-
title: "One"
-
title: "Two"

View file

@ -0,0 +1 @@
<%= data.test.map { |r| r.title }.join(":") %>

View file

@ -13,7 +13,7 @@ module Middleman::CoreExtensions::Data
module Helpers module Helpers
def data def data
@@data ||= Middleman::CoreExtensions::Data::DataObject.new(self) @@data ||= DataObject.new(self)
end end
end end
@ -82,11 +82,11 @@ module Middleman::CoreExtensions::Data
# #
# data.my_json # data.my_json
def data_source(name, url) def data_source(name, url)
Middleman::CoreExtensions::Data::DataObject.add_source(name, url) DataObject.add_source(name, url)
end end
def data_content(name, content) def data_content(name, content)
Middleman::CoreExtensions::Data::DataObject.data_content(name, content) DataObject.data_content(name, content)
end end
end end
end end