On Feb 14, 2011, at 7:08 PM, Kane Baccigalupi wrote: > We have had a really great integrated javascripting testing in our very > large, very javascripty Sinatra application. Our testing setup uses a > custom version of harmony (http://github.com/baccigalupi/harmony), that > reduces the out of control memory we were seeing in the original gem. > The trade off has been performance, but it has been worth it since > harmony without these modifications get above 2G of memory consumption. > That was bringing our development box to its knees. The custom version > of harmony creates individual window objects with each request which can > then be garbage collected at the end of usage. It worked great in rspec > 1.x. Here was our setup: > > describe 'some javascript class' do > before :all do > @dom = Harmony::Page.new(my_ruby_view) > @dom.load(some_js_files) > end > > it 'should do something' do > @dom.execute_js('javascript here').should == what_we_expect > end > end > > We are upgrading to RSpec 2, which has been a lot more involved and > undocumented than we had hoped.
Please let me know what is not yet documented on the following pages: http://relishapp.com/rspec/rspec-core/v/2-5/file/upgrade http://relishapp.com/rspec/rspec-expectations/v/2-5/file/upgrade http://relishapp.com/rspec/rspec-mocks/v/2-5/file/upgrade http://relishapp.com/rspec/rspec-rails/v/2-5/file/upgrade > Our biggest issue though is that the memory reduction measures that we > added to the harmony gem are no longer working. Presumably this is > because RSpec 2 is hanging on to the variables somewhere that we cannot > find. Setting our harmony Page objects to nil is not working: > > # in the spec_helper Rspec.configure block: > config.after(:all) do > puts 'about to cleanup' > @dom = nil > GC.start # trying to cleanup via Ruby > puts Johnson.evaluate <<-JS > Johnson.runtime.gc(); // trying to cleanup via JS > JS > end > > We have tried a lot of ordering combinations in our garbage collection > to see if anything will work, but instead the memory is climbing out of > control with each suite. In version RSpec 1.x we didn't have to do any > manual garbage collection. Nor should you have to. Can you use after(:each) instead of after all? config.after(:each) { @dom = nil } _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users