Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved html template out to a separate file

  • Loading branch information...
commit 697a71f6a807a137b528358e75609f002b251ae7 1 parent 871c616
@markryall markryall authored
Showing with 15 additions and 19 deletions.
  1. +5 −19 script/generate
  2. +10 −0 script/templates/test.html.erb
View
24 script/generate
@@ -12,28 +12,14 @@ def with_template name
yield template
end
-html_template = ERB.new <<EOF, 0, "%<>"
-<html>
-<head>
-</head>
-<body>
-% simple_elements.each do |element|
- <<%= element %>><%= element %> unexpected content</<%= element %>>
- <<%= element %> id="<%= element %>_identifier"><%= element %> expected content</<%= element %>>
-% end
-</body>
-</html>
-EOF
-
simple_elements = []
simple_elements += (1..6).map{|i| "h#{i}"}
-simple_elements += %w{div}
-simple_elements += %w{span}
-simple_elements += %w{p}
-# simple_elements += %w{i strong}
+simple_elements += %w{div span p}
-File.open 'features/support/test.html', 'w' do |f|
- f.puts html_template.result(binding)
+with_template 'test.html' do |html_template|
+ File.open 'features/support/test.html', 'w' do |f|
+ f.puts html_template.result(binding)
+ end
end
with_template 'feature' do |feature_template|
View
10 script/templates/test.html.erb
@@ -0,0 +1,10 @@
+<html>
+<head>
+</head>
+<body>
+% simple_elements.each do |element|
+ <<%= element %>><%= element %> unexpected content</<%= element %>>
+ <<%= element %> id="<%= element %>_identifier"><%= element %> expected content</<%= element %>>
+% end
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.