Sha256: bfd5ce28ceebb43e22ee45628ce6db32baa6d897f84c6b1d7c4c920c026b10d7
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require File.expand_path("../spec_helper", __dir__) RSpec.describe Redstream::Model do it "adds a delay message after save" do expect(redis.xlen(Redstream.stream_key_name("products.delay"))).to eq(0) time = Time.now product = Timecop.freeze(time) do create(:product) end expect(redis.xlen(Redstream.stream_key_name("products.delay"))).to eq(1) expect(redis.xrange(Redstream.stream_key_name("products.delay"), "-", "+").first[1]).to eq("payload" => JSON.dump(product.redstream_payload)) end it "adds a delay message after touch" do expect(redis.xlen(Redstream.stream_key_name("products.delay"))).to eq(0) product = create(:product) time = Time.now Timecop.freeze(time) do product.touch end expect(redis.xlen(Redstream.stream_key_name("products.delay"))).to eq(2) expect(redis.xrange(Redstream.stream_key_name("products.delay"), "-", "+").last[1]).to eq("payload" => JSON.dump(product.redstream_payload)) end it "adds a delay message after destroy" do expect(redis.xlen(Redstream.stream_key_name("products.delay"))).to eq(0) product = create(:product) time = Time.now Timecop.freeze(time) do product.touch end expect(redis.xlen(Redstream.stream_key_name("products.delay"))).to eq(2) expect(redis.xrange(Redstream.stream_key_name("products.delay"), "-", "+").last[1]).to eq("payload" => JSON.dump(product.redstream_payload)) end it "adds a queue message after commit" do expect(redis.xlen(Redstream.stream_key_name("products"))).to eq(0) product = create(:product) expect(redis.xlen(Redstream.stream_key_name("products"))).to eq(1) expect(redis.xrange(Redstream.stream_key_name("products"), "-", "+").first[1]).to eq("payload" => JSON.dump(product.redstream_payload)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redstream-0.0.1 | spec/redstream/model_spec.rb |