Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test improvements #174

Merged
merged 10 commits into from
Nov 7, 2018
14 changes: 6 additions & 8 deletions spec/lib/message_bus/backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,8 @@ def new_test_bus
@bus.global_backlog.to_a.must_equal expected_messages
end

it "should cope with a redis reset cleanly" do
test_only :redis

@bus.publish("/foo", "1")
it "should cope with a storage reset cleanly" do
@bus.publish("/foo", "one")
got = []

t = Thread.new do
Expand All @@ -212,19 +210,19 @@ def new_test_bus
# I thought about adding a subscribed callback, but outside of testing it matters less
sleep 0.05

@bus.publish("/foo", "2")
@bus.publish("/foo", "two")

@bus.pub_redis.flushdb
@bus.reset!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I much prefer reset methods, way cleaner


@bus.publish("/foo", "3")
@bus.publish("/foo", "three")

wait_for(100) do
got.length == 2
end

t.kill

got.map { |m| m.data }.must_equal ["2", "3"]
got.map { |m| m.data }.must_equal ["two", "three"]
got[1].global_id.must_equal 1
end

Expand Down