On Sep 12, 2008, at 9:29 AM, Matt Wynne wrote:
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.
That sounds like a good idea. You can also Kernel#` directly (instead
of `foo` call Kernel.send(:`, "foo"). This allows you to stub out
Kernel#`.
Scott
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users