Sha256: fb8cb0c3c913c3df91cb0f92e6379dd6ff92e1e4ad048bd6522d15ce63a4366d

Contents?: true

Size: 1.15 KB

Versions: 3

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
    }

    deltas.should == [8, 6, 4, 2]
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mcfly-0.0.22 spec/no_trans_spec.rb
mcfly-0.0.21 spec/no_trans_spec.rb
mcfly-0.0.20 spec/no_trans_spec.rb