Sha256: 26ed28b19cc2f3c9d34ad908388ba4b8e93ca6643b103a26159248a76a530a08
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Mcfly" do self.use_transactional_tests = false after(:each) do ActiveRecord::Base.connection.execute("TRUNCATE security_instruments;") end before(:each) do Mcfly.whodunnit = {id: 10} @dts = ['2001-01-01', '2001-01-05', '2001-01-10'] @sis = [ ["FN Fix-30 MBS", "A"], ["FN Fix-30 Cash", "A"], ["FN Fix-30 MBS Blend", "A"], ["FN Fix-30 HB MBS", "A"], ] @sis.each_with_index { |(name, sc), i| si = SecurityInstrument.new(name: name, settlement_class: sc) si.created_dt = @dts[i % @dts.length] si.save! } end it "deleted append-only records should have reasonable obsoleted_dt" do @sis[0..3].each { |name, st| osi = SecurityInstrument.find_by_name(name) osi.destroy # p ActiveRecord::Base.connection.execute("select now();").first sleep(2) } t = Time.now deltas = @sis[0..3].map { |name, st| (t - SecurityInstrument.find_by_name(name).obsoleted_dt).round } expect(deltas).to eq([8, 6, 4, 2]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mcfly-0.1.0 | spec/no_trans_spec.rb |