rename the new function

This commit is contained in:
maul.esel 2013-09-10 19:09:33 +02:00
parent 89f0d69b07
commit 3a18157d20
2 changed files with 7 additions and 7 deletions

View File

@ -142,19 +142,19 @@ Then /^the (.*) directory should exist$/ do |dir|
end
Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(text).match(read_file(file))
assert Regexp.new(text).match(file_contents(file))
end
Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file|
assert_equal text, read_file(file).strip
assert_equal text, file_contents(file).strip
end
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
assert_no_match Regexp.new(text), read_file(file)
assert_no_match Regexp.new(text), file_contents(file)
end
Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(Regexp.escape(text)).match(read_file(file))
assert Regexp.new(Regexp.escape(text)).match(file_contents(file))
end
Then /^the "(.*)" file should exist$/ do |file|
@ -166,9 +166,9 @@ Then /^the "(.*)" file should not exist$/ do |file|
end
Then /^I should see today's time in "(.*)"$/ do |file|
assert_match Regexp.new(Regexp.escape(Time.now.to_s)), read_file(file)
assert_match Regexp.new(Regexp.escape(Time.now.to_s)), file_contents(file)
end
Then /^I should see today's date in "(.*)"$/ do |file|
assert_match Regexp.new(Date.today.to_s), read_file(file)
assert_match Regexp.new(Date.today.to_s), file_contents(file)
end

View File

@ -35,7 +35,7 @@ def location(folder, direction)
[before || '.', after || '.']
end
def read_file(path)
def file_contents(path)
File.open(path) do |file|
file.readlines.join # avoid differences with \n and \r\n line endings
end