1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/test/test_sidekiq.rb

37 lines
No EOL
1 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# encoding: utf-8
require 'helper'
class TestSidekiq < MiniTest::Unit::TestCase
describe 'json processing' do
it 'loads json' do
assert_equal ({"foo" => "bar"}), Sidekiq.load_json("{\"foo\":\"bar\"}")
end
it 'dumps json' do
assert_equal "{\"foo\":\"bar\"}", Sidekiq.dump_json({ "foo" => "bar" })
end
end
describe "redis connection" do
it "returns error without creating a connection if block is not given" do
mock = MiniTest::Mock.new
mock.expect :create, nil #Sidekiq::RedisConnection, create
assert_raises(ArgumentError) {
Sidekiq.redis
}
assert_raises(MockExpectationError, "create should not be called") do
mock.verify
end
end
end
describe "❨╯°□°❩╯︵┻━┻" do
before { $stdout = StringIO.new }
after { $stdout = STDOUT }
it "allows angry developers to express their emotional constitution and remedies it" do
Sidekiq.°°
assert_equal "Calm down, bro\n", $stdout.string
end
end
end