Commit 530ce2a5 authored by Sylvester Keil's avatar Sylvester Keil

fix test dependencies

parent 0bfa860f
...@@ -2,11 +2,12 @@ source 'https://rubygems.org' ...@@ -2,11 +2,12 @@ source 'https://rubygems.org'
gemspec gemspec
group :development do group :development do
gem 'minitest', '< 5.0'
gem 'rake' gem 'rake'
gem 'redgreen', '~> 1.2' gem 'redgreen', '~> 1.2'
gem 'shoulda', '~> 3.5' gem 'shoulda', '~> 3.5'
gem 'rr', '~> 1.1' gem 'rr', '~> 1.1'
gem 'cucumber', '~> 1.3' gem 'cucumber', '=1.3.10'
gem 'RedCloth', '~> 4.2' gem 'RedCloth', '~> 4.2'
gem 'rdiscount', '~> 1.6' gem 'rdiscount', '~> 1.6'
gem 'redcarpet', '~> 3.0' gem 'redcarpet', '~> 3.0'
......
...@@ -24,7 +24,6 @@ Feature: BibTeX ...@@ -24,7 +24,6 @@ Feature: BibTeX
And the "_site/references.html" file should exist And the "_site/references.html" file should exist
And I should see "<i>The Ruby Programming Language</i>" in "_site/references.html" And I should see "<i>The Ruby Programming Language</i>" in "_site/references.html"
@converters
Scenario: Markdown Formatted Bibliography Scenario: Markdown Formatted Bibliography
Given I have a scholar configuration with: Given I have a scholar configuration with:
| key | value | | key | value |
......
Before do
FileUtils.rm_rf(TEST_DIR)
FileUtils.mkdir(TEST_DIR)
Dir.chdir(TEST_DIR)
end
After do
Dir.chdir(TEST_DIR)
FileUtils.rm_rf(TEST_DIR)
end
# Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it # Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it
Given /^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text| Given(/^I have an? "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/) do |file, key, value, text|
File.open(file, 'w') do |f| File.open(file, 'w') do |f|
f.write <<EOF f.write <<EOF
--- ---
...@@ -22,21 +12,21 @@ EOF ...@@ -22,21 +12,21 @@ EOF
end end
end end
Given /^I have an? "(.*)" file that contains "(.*)"$/ do |file, text| Given(/^I have an? "(.*)" file that contains "(.*)"$/) do |file, text|
File.open(file, 'w') do |f| File.open(file, 'w') do |f|
f.write(text) f.write(text)
f.close f.close
end end
end end
Given /^I have a configuration file with "(.*)" set to "(.*)"$/ do |key, value| Given(/^I have a configuration file with "(.*)" set to "(.*)"$/) do |key, value|
File.open('_config.yml', 'w') do |f| File.open('_config.yml', 'w') do |f|
f.write("#{key}: #{value}\n") f.write("#{key}: #{value}\n")
f.close f.close
end end
end end
Given /^I have a configuration file with:$/ do |table| Given(/^I have a configuration file with:$/) do |table|
File.open('_config.yml', 'w') do |f| File.open('_config.yml', 'w') do |f|
table.hashes.each do |row| table.hashes.each do |row|
f.write("#{row["key"]}: #{row["value"]}\n") f.write("#{row["key"]}: #{row["value"]}\n")
...@@ -45,28 +35,28 @@ Given /^I have a configuration file with:$/ do |table| ...@@ -45,28 +35,28 @@ Given /^I have a configuration file with:$/ do |table|
end end
end end
When /^I run jekyll$/ do When(/^I run jekyll$/) do
run_jekyll run_jekyll
end end
Then /^the (.*) directory should exist$/ do |dir| Then(/^the (.*) directory should exist$/) do |dir|
assert File.directory?(dir) assert File.directory?(dir)
end end
Then /^I should see "(.*)" in "(.*)"$/ do |text, file| Then(/^I should see "(.*)" in "(.*)"$/) do |text, file|
puts File.open(file).readlines.join puts File.open(file).readlines.join
assert_match Regexp.new(text), File.open(file).readlines.join assert_match Regexp.new(text), File.open(file).readlines.join
end end
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file| Then(/^I should not see "(.*)" in "(.*)"$/) do |text, file|
assert !File.open(file).readlines.join.match(Regexp.new(text)) assert !File.open(file).readlines.join.match(Regexp.new(text))
end end
Then /^the "(.*)" file should exist$/ do |file| Then(/^the "(.*)" file should exist$/) do |file|
assert File.file?(file) assert File.file?(file)
end end
Then /^the "(.*)" file should not exist$/ do |file| Then(/^the "(.*)" file should not exist$/) do |file|
assert !File.exists?(file) assert !File.exists?(file)
end end
Before do
FileUtils.mkdir_p(TEST_DIR) unless File.exist?(TEST_DIR)
Dir.chdir(TEST_DIR)
end
After do
FileUtils.rm_rf(TEST_DIR) if File.exist?(TEST_DIR)
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment