On 12 Sep 2008, at 14:12, Joaquin Rivera Padron wrote:
what is the best (or any) way of mocking the running of shell
commands?
e.g.
code like the following:
def method
%{ ls }
end
spec:
it "should list the directory contents"
shell = mock(Object) # %{} lives in Kernel module and its sugar
for `
shell.should_receive(:`).with(:ls)
end
sorry about latter one, thanks in advance
joaquin
I suggest you put a 'seam' between your code and the call the Kernel.
See Pat's excellent answer to a similar question in this thread:
http://www.ruby-forum.com/topic/164893#new
cheers,
Matt
----
http://blog.mattwynne.net
http://songkick.com
In case you wondered: The opinions expressed in this email are my own
and do not necessarily reflect the views of any former, current or
future employers of mine.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users