features/steps/common.rb in newgem-1.2.1 vs features/steps/common.rb in newgem-1.2.2
- old
+ new
@@ -57,32 +57,42 @@
@stdout.rewind
f << @stdout.read
end
end
+When %r{run executable '(.*)' with arguments '(.*)'} do |executable, arguments|
+ @stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
+ in_project_folder do
+ system "#{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
+ end
+end
+
When %r{run project executable '(.*)' with arguments '(.*)'} do |executable, arguments|
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
in_project_folder do
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
end
end
When %r{run local executable '(.*)' with arguments '(.*)'} do |executable, arguments|
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
- system "ruby bin/#{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
+ executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
+ in_project_folder do
+ system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
+ end
end
When %r{^task 'rake (.*)' is invoked$} do |task|
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
FileUtils.chdir(@active_project_folder) do
system "rake #{task} --trace > #{@stdout} 2> #{@stdout}"
end
end
-Then %r{^folder '(.*)' is created} do |folder|
+Then %r{^folder '(.*)' (is|is not) created} do |folder, is|
in_project_folder do
- File.exists?(folder).should be_true
+ File.exists?(folder).should(is == 'is' ? be_true : be_false)
end
end
Then %r{^file '(.*)' (is|is not) created} do |file, is|
in_project_folder do
@@ -109,10 +119,10 @@
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
actual_output.should == expected_output
end
Then %r{^(does|does not) invoke generator '(.*)'$} do |does_invoke, generator|
- actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
+ actual_output = File.read(@stdout)
does_invoke == "does" ?
actual_output.should(match(/dependency\s+#{generator}/)) :
actual_output.should_not(match(/dependency\s+#{generator}/))
end