From f16b12e4031cdff7f6b16031b7d17ec5582576a0 Mon Sep 17 00:00:00 2001 From: Yuya Takeyama Date: Sun, 1 Jan 2012 17:29:39 +0900 Subject: [PATCH] Added a step to check file content partially. --- features/file_system_commands.feature | 14 ++++++++++++++ lib/aruba/cucumber.rb | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/features/file_system_commands.feature b/features/file_system_commands.feature index 9de530a81..371e95e43 100644 --- a/features/file_system_commands.feature +++ b/features/file_system_commands.feature @@ -143,6 +143,20 @@ Feature: file system commands Then the file "foo" should match /hel.o world/ And the file "foo" should not match /HELLO WORLD/ + Scenario: Check file contents with docstring + Given a file named "foo" with: + """ + foo + bar + baz + foobar + """ + Then the file "foo" should contain: + """ + bar + baz + """ + Scenario: Remove file Given a file named "foo" with: """ diff --git a/lib/aruba/cucumber.rb b/lib/aruba/cucumber.rb index 66e83eb98..8072fb75b 100644 --- a/lib/aruba/cucumber.rb +++ b/lib/aruba/cucumber.rb @@ -248,6 +248,10 @@ check_file_content(file, partial_content, false) end +Then /^the file "([^"]*)" should contain:$/ do |file, partial_content| + check_file_content(file, partial_content, true) +end + Then /^the file "([^"]*)" should contain exactly:$/ do |file, exact_content| check_exact_file_content(file, exact_content) end