Before do FileUtils.mkdir(TEST_DIR) Dir.chdir(TEST_DIR) end After do Dir.chdir(TEST_DIR) FileUtils.rm_rf(TEST_DIR) end Given /^I have a blank site in "(.*)"$/ do |path| FileUtils.mkdir(path) end # Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it Given /^I have an "(.*)" page(?: with layout "(.*)")? that contains "(.*)"$/ do |file, layout, text| File.open(file, 'w') do |f| f.write < true) end When /^I run jekyll$/ do run_jekyll end When /^I change "(.*)" to contain "(.*)"$/ do |file, text| File.open(file, 'a') do |f| f.write(text) end end When /^I go to "(.*)"$/ do |address| pending end Then /^the (.*) directory should exist$/ do |dir| assert File.directory?(dir) end Then /^I should see "(.*)" in "(.*)"$/ do |text, file| assert_match Regexp.new(text), File.open(file).readlines.join end Then /^the "(.*)" file should not exist$/ do |file| assert !File.exists?(file) end Then /^I should see today's date in "(.*)"$/ do |file| assert_match Regexp.new(Date.today.to_s), File.open(file).readlines.join end