Sha256: be57d56e387b8c56203879a8758b644b418af20fdff176d0ba22231cc4daa5db

Contents?: true

Size: 542 Bytes

Versions: 6

Compression:

Stored size: 542 Bytes

Contents

require_relative "helper"

class Model < Ohm::Model
  attribute :hash
  index :hash

  attribute :data
end

test do
  50.times do |i|
    Ohm.flush

    Model.create(:hash => "123")

    assert_equal 1, Ohm.redis.call("SCARD", "Model:all")

    Thread.new do
      a = Model.find(:hash => "123").first
      a.update(:data => "2")
    end

    sleep 0.01

    b = Model.find(:hash => "123").first

    if Ohm.redis.call("SCARD", "Model:indices:hash:123") != 1
      flunk("Failed at iteration %d" % i)
    end

    assert ! b.nil?
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ohm-2.0.0.rc1 test/issue-52.rb
ohm-2.0.0.alpha5 test/issue-52.rb
ohm-2.0.0.alpha4 test/issue-52.rb
ohm-2.0.0.alpha3 test/issue-52.rb
ohm-2.0.0.alpha2 test/issue-52.rb
ohm-2.0.0.alpha1 test/issue-52.rb