Sha256: 04ca92b3e8846d214896e57173cb065191ea41ba27462195482f094e25772f01

Contents?: true

Size: 561 Bytes

Versions: 21

Compression:

Stored size: 561 Bytes

Contents

require 'rails_helper'

RSpec.describe "Memory Leak", type: :request, if: RUBY_ENGINE == 'ruby' do
  before do
    load_defaults!
  end

  def count_instances_of(klass)
    ObjectSpace.each_object(klass) { }
  end

  [ActiveAdmin::Namespace, ActiveAdmin::Resource].each do |klass|
    it "should not leak #{klass}" do
      previously_disabled = GC.enable
      GC.start
      count = count_instances_of(klass)

      load_defaults!

      GC.start
      GC.disable if previously_disabled
      expect(count_instances_of klass).to be <= count
    end
  end
end

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
activeadmin-rails-1.7.1 spec/requests/memory_spec.rb
activeadmin-rails-1.7.0 spec/requests/memory_spec.rb
activeadmin-rb-1.6.0 spec/requests/memory_spec.rb
activeadmin-rb-1.5.2 spec/requests/memory_spec.rb
activeadmin-rb-1.5.1 spec/requests/memory_spec.rb
activeadmin-rb-1.5.0 spec/requests/memory_spec.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/requests/memory_spec.rb
activeadmin-rb-1.4.0 spec/requests/memory_spec.rb
activeadmin_addons-1.7.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/requests/memory_spec.rb
activeadmin-1.3.1 spec/requests/memory_spec.rb
activeadmin_addons-1.6.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/requests/memory_spec.rb
activeadmin_addons-1.5.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/spec/requests/memory_spec.rb
activeadmin-1.3.0 spec/requests/memory_spec.rb
activeadmin_addons-1.4.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/spec/requests/memory_spec.rb
activeadmin_addons-1.3.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/requests/memory_spec.rb
activeadmin_addons-1.2.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/requests/memory_spec.rb
activeadmin-1.2.1 spec/requests/memory_spec.rb
activeadmin-1.2.0 spec/requests/memory_spec.rb
activeadmin-1.1.0 spec/requests/memory_spec.rb
activeadmin-1.0.0 spec/requests/memory_spec.rb