test/unit/daemon_test.rb in refinery-0.10.8 vs test/unit/daemon_test.rb in refinery-0.10.9

- old
+ new

@@ -7,17 +7,19 @@ @waiting_queue = stub('Queue(waiting)') @error_queue = stub('Queue(error)') @done_queue = stub('Queue(done)') - Refinery::Daemon.any_instance.stubs(:require).with('java').raises(LoadError) - Refinery::Daemon.any_instance.stubs(:queue).with( - 'sample_waiting').returns(@waiting_queue) - Refinery::Daemon.any_instance.stubs(:queue).with( - 'sample_error').returns(@error_queue) - Refinery::Daemon.any_instance.stubs(:queue).with( - 'sample_done').returns(@done_queue) + @provider = stub('QueueProvider') + if defined?(Typica) + Typica::Sqs::QueueService.stubs(:new).returns(@provider) + else + RightAws::SqsGen2.stubs(:new).returns(@provider) + end + @provider.stubs(:queue).with('sample_waiting').returns(@waiting_queue) + @provider.stubs(:queue).with('sample_error').returns(@error_queue) + @provider.stubs(:queue).with('sample_done').returns(@done_queue) end should "be startable" do @waiting_queue.stubs(:receive) assert_nothing_raised do daemon = Refinery::Daemon.new(@processor, 'sample') @@ -27,15 +29,15 @@ @waiting_queue.stubs(:receive) daemon = Refinery::Daemon.new(@processor, 'sample') assert_not_nil daemon.logger end should "allow visibility setting" do - @waiting_queue.expects(:receive).with(600) + @waiting_queue.stubs(:receive).with(600) daemon = Refinery::Daemon.new(@processor, 'sample', '', {'visibility' => 600}) end should "have a queue name" do @waiting_queue.stubs(:receive) - Refinery::Daemon.any_instance.expects(:queue).with( + @provider.stubs(:queue).with( 'prefix_sample_waiting').returns(@waiting_queue) daemon = Refinery::Daemon.new(@processor, 'sample', 'prefix_') assert_equal 'prefix_sample', daemon.queue_name end context "that is started" do \ No newline at end of file