summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2013-10-23 16:53:18 -0600
committerDan Allen <dan.j.allen@gmail.com>2013-10-25 00:45:41 -0600
commita54baabc7f43d3cd4e4e3142b26d296438a08d5b (patch)
tree5b99a9cd805d6099f3c8e75c586c37c776ed1b86 /features
parent9dd3d83c3e4a2e30aa62f7057876fd41a5225bbe (diff)
resolves #731 add initial Cucumber test infrastructure
- add cucumber and rspec-expectations dependencies - add cucumber Rake task definition - add sample cucumber tests and a step definition rough-in - set version ranges for library dependencies
Diffstat (limited to 'features')
-rw-r--r--features/open_block.feature92
-rw-r--r--features/step_definitions.rb33
-rw-r--r--features/xref.feature37
3 files changed, 162 insertions, 0 deletions
diff --git a/features/open_block.feature b/features/open_block.feature
new file mode 100644
index 00000000..000b29a7
--- /dev/null
+++ b/features/open_block.feature
@@ -0,0 +1,92 @@
+# language: en
+Feature: Open Blocks
+ In order to group content in a generic container
+ As a writer
+ I want to be able to wrap content in an open block
+
+
+ Scenario: Render an open block that contains a paragraph to HTML
+ Given the AsciiDoc source
+ """
+ --
+ A paragraph in an open block.
+ --
+ """
+ When it is rendered using the html backend
+ Then the output should match the HTML source
+ """
+ <div class="openblock">
+ <div class="content">
+ <div class="paragraph">
+ <p>A paragraph in an open block.</p>
+ </div>
+ </div>
+ </div>
+ """
+
+
+ Scenario: Render an open block that contains a paragraph to DocBook
+ Given the AsciiDoc source
+ """
+ --
+ A paragraph in an open block.
+ --
+ """
+ When it is rendered using the docbook backend
+ Then the output should match the XML source
+ """
+ <simpara>A paragraph in an open block.</simpara>
+ """
+
+
+ Scenario: Render an open block that contains a paragraph to HTML (alt)
+ Given the AsciiDoc source
+ """
+ --
+ A paragraph in an open block.
+ --
+ """
+ When it is rendered using the html backend
+ Then the output should match the HTML structure
+ """
+ .openblock
+ .content
+ .paragraph
+ p A paragraph in an open block.
+ """
+
+
+ Scenario: Render an open block that contains a paragraph to DocBook (alt)
+ Given the AsciiDoc source
+ """
+ --
+ A paragraph in an open block.
+ --
+ """
+ When it is rendered using the docbook backend
+ Then the output should match the XML structure
+ """
+ simpara A paragraph in an open block.
+ """
+
+
+ Scenario: Render an open block that contains a list to HTML
+ Given the AsciiDoc source
+ """
+ --
+ * one
+ * two
+ * three
+ --
+ """
+ When it is rendered using the html backend
+ Then the output should match the HTML structure
+ """
+ .openblock
+ .content
+ .ulist
+ ul
+ li: p one
+ li: p two
+ li: p three
+ """
diff --git a/features/step_definitions.rb b/features/step_definitions.rb
new file mode 100644
index 00000000..3dc66cc6
--- /dev/null
+++ b/features/step_definitions.rb
@@ -0,0 +1,33 @@
+require "#{File.dirname __FILE__}/../lib/asciidoctor"
+require 'rspec/expectations'
+require 'tilt'
+require 'slim'
+
+Given /the AsciiDoc source/ do |source|
+ #@document = Asciidoctor.load source
+ @source = source
+end
+
+When /it is rendered using the html backend/ do
+ @output = Asciidoctor.render @source
+end
+
+When /it is rendered using the docbook backend/ do
+ @output = Asciidoctor.render @source, :backend => :docbook
+end
+
+Then /the output should match the (HTML|XML) source/ do |format, expect|
+ @output.should == expect
+end
+
+Then /the output should match the (HTML|XML) structure/ do |format, expect|
+ case format
+ when 'HTML'
+ options = {:format => :html5}
+ when 'XML'
+ options = {:format => :xhtml}
+ else
+ options = {}
+ end
+ Slim::Template.new(options) { @output }.render.should == Slim::Template.new(options) { expect }.render
+end
diff --git a/features/xref.feature b/features/xref.feature
new file mode 100644
index 00000000..dcb66528
--- /dev/null
+++ b/features/xref.feature
@@ -0,0 +1,37 @@
+# language: en
+Feature: Cross References
+ In order to create links to other sections
+ As a writer
+ I want to be able to use a cross reference macro
+
+
+ Scenario: Create a cross reference from an AsciiDoc cell to a section
+ Given the AsciiDoc source
+ """
+ |===
+ a|See <<_install>>
+ |===
+
+ == Install
+
+ Instructions go here.
+ """
+ When it is rendered using the html backend
+ Then the output should match the HTML structure
+ """
+ table.tableblock.frame-all.grid-all style='width:100%; '
+ colgroup
+ col style='width:100%;'
+ '
+ tbody
+ tr
+ td.tableblock.halign-left.valign-top
+ div
+ .paragraph: p
+ 'See
+ a href='#_install' Install
+ .sect1
+ h2#_install Install
+ .sectionbody
+ .paragraph: p Instructions go here.
+ """