Skip to content

Commit

Permalink
start converting cookbook examples to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
al2o3cr committed Dec 29, 2011
1 parent 268602a commit 98e04fd
Show file tree
Hide file tree
Showing 3 changed files with 428 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dryml/cucumber.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--require features --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip

44 changes: 44 additions & 0 deletions dryml/features/cookbook/01_simple_page_templates.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Feature: Simple page templates and ERB

Scenario: Interpolating in HTML attributes
Given a file named "example.dryml" with:
"""
<% my_url = '/foo/bar' %>
<a href="#{my_url}">Link Text</a>
"""
When I render "example.dryml"
Then the output DOM should be:
"""
<a href="/foo/bar">Link Text</a>
"""

Scenario: Merging a hash of attributes
Given a file named "example.dryml" with:
"""
<% hash = { :action => '/foo/bar', :method => 'get' } %>
<form merge-attrs="&hash">
<input type="text" name="wut" />
</form>
"""
When I render "example.dryml"
Then the output DOM should be:
"""
<form action="/foo/bar" method="get">
<input type="text" name="wut" />
</form>
"""

Scenario: Dynamically calling tags
Given a file named "example.dryml" with:
"""
<% my_tag_name = "div" %>
<%= raw "<#{my_tag_name}>" %>FOO<%= raw "</#{my_tag_name}>" %>
<call-tag tag="&my_tag_name">BAR</call-tag>
"""
When I render "example.dryml"
Then the output DOM should be:
"""
<div>FOO</div>
<div>BAR</div>
"""

0 comments on commit 98e04fd

Please sign in to comment.