Sha256: cffefd4fc4a394b04b3e44dd35f05ab583b29b515e7fee0882e4008723176252

Contents?: true

Size: 1.83 KB

Versions: 22

Compression:

Stored size: 1.83 KB

Contents

# require 'spec_helper'

# describe "state machines" do

#   def number_of_objects(klass)
#     ObjectSpace.each_object(klass) {}
#   end

#   def machines
#     AASM::StateMachineStore.instance_variable_get("@stores")
#   end

#   it "should be created without memory leak" do
#     machines_count = machines.size
#     state_count = number_of_objects(AASM::Core::State)
#     event_count = number_of_objects(AASM::Core::Event)
#     puts "event_count = #{event_count}"
#     transition_count = number_of_objects(AASM::Core::Transition)

#     load File.expand_path(File.dirname(__FILE__) + '/../models/not_auto_loaded/process.rb')
#     machines.size.should == machines_count + 1                                                  # + Process
#     number_of_objects(Models::Process).should == 0
#     number_of_objects(AASM::Core::State).should == state_count + 3                 # + Process
#     puts "event_count = #{number_of_objects(AASM::Core::Event)}"
#     number_of_objects(AASM::Core::Event).should == event_count + 2                 # + Process
#     number_of_objects(AASM::Core::Transition).should == transition_count + 2  # + Process

#     Models.send(:remove_const, "Process") if Models.const_defined?("Process")
#     load File.expand_path(File.dirname(__FILE__) + '/../models/not_auto_loaded/process.rb')
#     machines.size.should == machines_count + 1                                                  # + Process
#     number_of_objects(AASM::Core::State).should == state_count + 3                 # + Process
#     # ObjectSpace.each_object(AASM::Core::Event) {|o| puts o.inspect}
#     puts "event_count = #{number_of_objects(AASM::Core::Event)}"
#     number_of_objects(AASM::Core::Event).should == event_count + 2                 # + Process
#     number_of_objects(AASM::Core::Transition).should == transition_count + 2  # + Process
#   end

# end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
aasm-5.3.1 spec/unit/memory_leak_spec.rb
aasm-5.3.0 spec/unit/memory_leak_spec.rb
aasm-5.2.0 spec/unit/memory_leak_spec.rb
aasm-5.1.1 spec/unit/memory_leak_spec.rb
aasm-5.1.0 spec/unit/memory_leak_spec.rb
aasm-5.0.8 spec/unit/memory_leak_spec.rb
aasm-5.0.7 spec/unit/memory_leak_spec.rb
aasm-5.0.6 spec/unit/memory_leak_spec.rb
aasm-5.0.5 spec/unit/memory_leak_spec.rb
aasm-5.0.4 spec/unit/memory_leak_spec.rb
aasm-5.0.3 spec/unit/memory_leak_spec.rb
aasm-5.0.2 spec/unit/memory_leak_spec.rb
aasm-5.0.1 spec/unit/memory_leak_spec.rb
aasm-5.0.0 spec/unit/memory_leak_spec.rb
aasm-4.12.3 spec/unit/memory_leak_spec.rb
aasm-4.12.2 spec/unit/memory_leak_spec.rb
aasm-4.12.1 spec/unit/memory_leak_spec.rb
aasm-4.12.0 spec/unit/memory_leak_spec.rb
aasm-4.11.1 spec/unit/memory_leak_spec.rb
aasm-4.11.0 spec/unit/memory_leak_spec.rb