Use File#read instead of #readlines.join construct

This commit is contained in:
maul.esel 2013-09-02 14:00:58 +02:00
parent 2cc5dc3704
commit be54303fa9
1 changed files with 5 additions and 5 deletions

View File

@ -142,11 +142,11 @@ Then /^the (.*) directory should exist$/ do |dir|
end
Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(text).match(File.open(file).readlines.join)
assert Regexp.new(text).match(File.read(file))
end
Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file|
assert_equal text, File.open(file).readlines.join.strip
assert_equal text, File.read(file).strip
end
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
@ -154,7 +154,7 @@ Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
end
Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join)
assert Regexp.new(Regexp.escape(text)).match(File.read(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)), File.open(file).readlines.join
assert_match Regexp.new(Regexp.escape(Time.now.to_s)), File.read(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
assert_match Regexp.new(Date.today.to_s), File.read(file)
end