diff --git a/lib/money/rates_store/memory.rb b/lib/money/rates_store/memory.rb index a974f37dae..9b028d4012 100644 --- a/lib/money/rates_store/memory.rb +++ b/lib/money/rates_store/memory.rb @@ -58,10 +58,9 @@ def get_rate(currency_iso_from, currency_iso_to) end def marshal_dump - [self.class, index, options] + [self.class, options, index] end - # Wraps block execution in a thread-safe transaction def transaction(&block) if @in_transaction || options[:without_mutex] diff --git a/spec/rates_store/memory_spec.rb b/spec/rates_store/memory_spec.rb index 9ea27f53be..2d7d11326e 100644 --- a/spec/rates_store/memory_spec.rb +++ b/spec/rates_store/memory_spec.rb @@ -66,4 +66,15 @@ end end end + + describe '#marshal_dump' do + let(:subject) { Money::RatesStore::Memory.new(:optional => true) } + + it 'can reload' do + bank = Money::Bank::VariableExchange.new(subject) + bank = Marshal.load(Marshal.dump(bank)) + expect(bank.store.instance_variable_get(:@options)).to eq subject.instance_variable_get(:@options) + expect(bank.store.instance_variable_get(:@index)).to eq subject.instance_variable_get(:@index) + end + end end