Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby 1.9.1 with rspec "can't modify frozen object"

Tags:

ruby

rspec

I just updated to Ruby 1.9.1 and nearly all my rspec are broken giving me a "can't modify frozen object". Even the Rspec sample code from a generate rspec_controller fails.

RuntimeError in 'DownloadsController should use DownloadsController'
can't modify frozen object                                                                                                                                                          
/usr/local/lib/ruby19/1.9.1/timeout.rb:44:in `timeout'


Generated by the following code: 

it "should use DownloadsController" do
  controller.should be_an_instance_of(DownloadsController)
end

Can anyone help ?

like image 579
xto Avatar asked Sep 22 '09 13:09

xto


1 Answers

Are you use you aren't trying to stub something that is nil.

In 1.8 nil wasn't frozen. It is however frozen in ruby 1.9.

like image 83
shaner Avatar answered Oct 21 '22 03:10

shaner