spec/config_spec.rb in queue-bus-0.5.9 vs spec/config_spec.rb in queue-bus-0.6.0

- old
+ new

@@ -8,75 +8,75 @@ end end describe "QueueBus config" do it "should set the default app key" do - QueueBus.default_app_key.should == nil + expect(QueueBus.default_app_key).to eq(nil) QueueBus.default_app_key = "my_app" - QueueBus.default_app_key.should == "my_app" + expect(QueueBus.default_app_key).to eq("my_app") QueueBus.default_app_key = "something here" - QueueBus.default_app_key.should == "something_here" + expect(QueueBus.default_app_key).to eq("something_here") end it "should set the default queue" do - QueueBus.default_queue.should == nil + expect(QueueBus.default_queue).to eq(nil) QueueBus.default_queue = "my_queue" - QueueBus.default_queue.should == "my_queue" + expect(QueueBus.default_queue).to eq("my_queue") end it "should set the local mode" do - QueueBus.local_mode.should == nil + expect(QueueBus.local_mode).to eq(nil) QueueBus.local_mode = :standalone - QueueBus.local_mode.should == :standalone + expect(QueueBus.local_mode).to eq(:standalone) end it "should set the hostname" do - QueueBus.hostname.should_not == nil + expect(QueueBus.hostname).not_to eq(nil) QueueBus.hostname = "whatever" - QueueBus.hostname.should == "whatever" + expect(QueueBus.hostname).to eq("whatever") end it "should set before_publish callback" do QueueBus.before_publish = lambda {|attributes| 42 } - QueueBus.before_publish_callback({}).should == 42 + expect(QueueBus.before_publish_callback({})).to eq(42) end it "should use the default Redis connection" do - QueueBus.redis { |redis| redis }.should_not eq(nil) + expect(QueueBus.redis { |redis| redis }).not_to eq(nil) end it "should default to given adapter" do - QueueBus.adapter.is_a?(adapter_under_test_class).should == true + expect(QueueBus.adapter.is_a?(adapter_under_test_class)).to eq(true) # and should raise if already set - lambda { + expect { QueueBus.adapter = :data - }.should raise_error + }.to raise_error(RuntimeError, "Adapter already set to QueueBus::Adapters::Data") end context "with a fresh load" do before(:each) do QueueBus.send(:reset) end it "should be able to be set to resque" do QueueBus.adapter = adapter_under_test_symbol - QueueBus.adapter.is_a?(adapter_under_test_class).should == true + expect(QueueBus.adapter.is_a?(adapter_under_test_class)).to eq(true) # and should raise if already set - lambda { + expect { QueueBus.adapter = :data - }.should raise_error + }.to raise_error(RuntimeError, "Adapter already set to QueueBus::Adapters::Data") end it "should be able to be set to something else" do QueueBus.adapter = :test_one - QueueBus.adapter.is_a?(QueueBus::Adapters::TestOne).should == true + expect(QueueBus.adapter.is_a?(QueueBus::Adapters::TestOne)).to eq(true) end end end