Skip to content

Instantly share code, notes, and snippets.

@torbjoernk
Created July 14, 2012 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torbjoernk/3113509 to your computer and use it in GitHub Desktop.
Save torbjoernk/3113509 to your computer and use it in GitHub Desktop.
This raises SystemStackError: stack level too deep
require "rspec"
require "rspec/expectations"
require "rspec/mocks"
RSpec.configure do |config|
end
describe "SystemStackError: stack level too deep" do
it "is raised by this" do
file = "test_file"
expected = "this should be written to test_file"
File.should_receive( :open ).with( file, "w" )
IO.any_instance.should_receive( :puts ).with( expected )
File.open( file, "w" ) do |f|
f.puts expected
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment