From 4c7dbaa32ec250ff5d8d43f99a09865fddb20468 Mon Sep 17 00:00:00 2001 From: David Moxey Date: Sun, 13 Apr 2014 19:29:38 +0100 Subject: [PATCH] Add feature for string tests --- features/string.feature | 114 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 features/string.feature diff --git a/features/string.feature b/features/string.feature new file mode 100644 index 0000000..1154344 --- /dev/null +++ b/features/string.feature @@ -0,0 +1,114 @@ +Feature: String replacement + As a scholar who likes to blog + I want to publish my BibTeX bibliography on my blog + And make sure that strings are correctly substituted + + @tags @string + Scenario: String replacement + Given I have a scholar configuration with: + | key | value | + | source | ./_bibliography | + And I have a "_bibliography" directory + And I have a file "_bibliography/references.bib": + """ + @string{ rubypl = "The Ruby Programming Language" } + @book{ruby, + title = rubypl, + author = {Flanagan, David and Matsumoto, Yukihiro}, + year = {2008}, + publisher = {O'Reilly Media} + } + """ + And I have a page "scholar.html": + """ + --- + --- + {% bibliography -f references %} + """ + When I run jekyll + Then the _site directory should exist + And the "_site/scholar.html" file should exist + And I should see "The Ruby Programming Language" in "_site/scholar.html" + + @tags @string + Scenario: String replacement disabled + Given I have a scholar configuration with: + | key | value | + | source | ./_bibliography | + | replace_strings | false | + And I have a "_bibliography" directory + And I have a file "_bibliography/references.bib": + """ + @string{ rubypl = "The Ruby Programming Language" } + @book{ruby, + title = rubypl, + author = {Flanagan, David and Matsumoto, Yukihiro}, + year = {2008}, + publisher = {O'Reilly Media} + } + """ + And I have a page "scholar.html": + """ + --- + --- + {% bibliography -f references %} + """ + When I run jekyll + Then the _site directory should exist + And the "_site/scholar.html" file should exist + And I should see "rubypl" in "_site/scholar.html" + + @tags @string + Scenario: Join strings + Given I have a scholar configuration with: + | key | value | + | source | ./_bibliography | + And I have a "_bibliography" directory + And I have a file "_bibliography/references.bib": + """ + @string{ ruby = "Ruby" } + @book{ruby, + title = "The " # ruby # " Programming Language", + author = {Flanagan, David and Matsumoto, Yukihiro}, + year = {2008}, + publisher = {O'Reilly Media} + } + """ + And I have a page "scholar.html": + """ + --- + --- + {% bibliography -f references %} + """ + When I run jekyll + Then the _site directory should exist + And the "_site/scholar.html" file should exist + And I should see "The Ruby Programming Language" in "_site/scholar.html" + + @tags @string + Scenario: Join strings disabled + Given I have a scholar configuration with: + | key | value | + | source | ./_bibliography | + | join_strings | false | + And I have a "_bibliography" directory + And I have a file "_bibliography/references.bib": + """ + @string{ ruby = "Ruby" } + @book{ruby, + title = "The " # ruby # " Programming Language", + author = {Flanagan, David and Matsumoto, Yukihiro}, + year = {2008}, + publisher = {O'Reilly Media} + } + """ + And I have a page "scholar.html": + """ + --- + --- + {% bibliography -f references %} + """ + When I run jekyll + Then the _site directory should exist + And the "_site/scholar.html" file should exist + And I should see "\"The \" # \"Ruby\" # \" Programming Language\"" in "_site/scholar.html" -- GitLab