Sha256: 65646a6cd51f2dfefa55280cbd10e859c210e506ce12326b0475c8b5caea1052

Contents?: true

Size: 526 Bytes

Versions: 11

Compression:

Stored size: 526 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.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.scard("Model:indices:hash:123") != 1
      flunk("Failed at iteration %d" % i)
    end

    assert ! b.nil?
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ohm-1.4.0 test/issue-52.rb
ohm-1.3.2 test/issue-52.rb
ohm-1.3.1 test/issue-52.rb
ohm-1.3.0 test/issue-52.rb
ohm-1.2.0 test/issue-52.rb
ohm-1.1.2 test/issue-52.rb
ohm-1.1.1 test/issue-52.rb
ohm-1.1.0 test/issue-52.rb
ohm-1.1.0.rc1 test/issue-52.rb
ohm-1.0.2 test/issue-52.rb
ohm-1.0.1 test/issue-52.rb