Skip to content

Instantly share code, notes, and snippets.

@pellegrino
Created May 18, 2011 21:46
Show Gist options
  • Select an option

  • Save pellegrino/979642 to your computer and use it in GitHub Desktop.

Select an option

Save pellegrino/979642 to your computer and use it in GitHub Desktop.
when to mock or not to mock?
module RubyAck
class Invoker
def invoke(ack_string)
IO.popen("ack #{ack_string} --column") { |io| io.readlines }
end
end
end
describe RubyAck::Invoker do
it "should invoke ack with --column as a default for the given parameter" do
IO.should_receive(:popen).with("ack jackpot --column")
invoker = RubyAck::Invoker.new
invoker.invoke("jackpot")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment