From 7348945c4114f414881062363a630b16ee1a665c Mon Sep 17 00:00:00 2001 From: Artem Ignatyev Date: Fri, 29 Jan 2016 16:09:58 -0800 Subject: [PATCH] Experimental Rubinius support --- .travis.yml | 1 + README.md | 1 + spec/client_middleware_spec.rb | 4 ++-- spec/container_spec.rb | 2 +- spec/spec_helper.rb | 4 ++++ spec/worker_spec.rb | 4 ++-- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d94e070..3215e72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ rvm: - 2.1.4 - 2.2.4 - 2.3.0 + - rbx-3.14 env: global: - SHOW_SIDEKIQ=true diff --git a/README.md b/README.md index 23bf8ac..aadc45f 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,7 @@ and clean status containers. * Support for sidekiq 4.1, 4.0, 3.5, 3.4 * Dropped support for sidekiq versions older than 3.3 * Dropped support for ruby 1.9.x, 2.0.x + * Experimental support for Rubinius ### 1.0.7 diff --git a/spec/client_middleware_spec.rb b/spec/client_middleware_spec.rb index 1eb3c1c..43b4d90 100644 --- a/spec/client_middleware_spec.rb +++ b/spec/client_middleware_spec.rb @@ -5,7 +5,7 @@ describe "cryo28/sidekiq_status#11 regression" do describe "#call" do before do - SidekiqStatus::Container.should_receive(:create).with(hash_including('worker' => 'TestWorker1')) + expect(SidekiqStatus::Container).to receive(:create).with(hash_including('worker' => 'TestWorker1')) end it "accepts a worker class" do @@ -21,7 +21,7 @@ end it "does not create container for scheduled job" do - SidekiqStatus::Container.should_not_receive(:create) + expect(SidekiqStatus::Container).to_not receive(:create) subject.call("TestWorker1", { "at" => Time.now }, nil) do end diff --git a/spec/container_spec.rb b/spec/container_spec.rb index 4079c6f..529bc9c 100644 --- a/spec/container_spec.rb +++ b/spec/container_spec.rb @@ -91,7 +91,7 @@ def test_container(container, hash, jid = nil) end specify ".create" do - SecureRandom.should_receive(:hex).with(12).and_return(jid) + expect(SecureRandom).to receive(:hex).with(12).and_return(jid) args = ['arg1', 'arg2', {arg3: 'val3'}] container = described_class.create('args' => args) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c10389b..9d309fa 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,6 +25,10 @@ require GEM_ROOT.join('spec/dummy/boot.rb') RSpec.configure do |c| + c.expect_with :rspec do |expectations| + expectations.syntax = [:should, :expect] + end + c.before do Sidekiq.redis{ |conn| conn.flushdb } end diff --git a/spec/worker_spec.rb b/spec/worker_spec.rb index a1da641..b0bf905 100644 --- a/spec/worker_spec.rb +++ b/spec/worker_spec.rb @@ -27,7 +27,7 @@ def some_method(*args); end let(:worker) { SomeWorker.new } it "receives jid as parameters, loads container and runs original perform with enqueued args" do - worker.should_receive(:some_method).with(*args) + expect(worker).to receive(:some_method).with(*args) jid = SomeWorker.perform_async(*args) worker.perform(jid) end @@ -50,7 +50,7 @@ def some_method(*args); end it "intercepts failures and set status to 'failed' then re-raises the exception" do exc = RuntimeError.new('Some error') - worker.stub(:some_method).and_raise(exc) + allow(worker).to receive(:some_method).and_raise(exc) jid = SomeWorker.perform_async(*args) expect{ worker.perform(jid) }.to raise_exception{ |error| error.object_id.should == exc.object_id }