spec/unit/service_spec.rb in hoth-0.3.0 vs spec/unit/service_spec.rb in hoth-0.3.1
- old
+ new
@@ -40,10 +40,19 @@
service = Service.new("test_service") { |p1, p2| returns :nothing }
service.should_receive(:is_local?).and_return(true)
service.impl_class.should_receive(:execute).with(:arg1, :arg2)
- service.execute(:arg1, :arg2)
+ service.execute(:arg1, :arg2).should be(nil)
+ end
+
+ it "should execute the service stub locally if its impl-class was found and return a value" do
+ service = Service.new("test_service") { |p1, p2| returns :value }
+
+ service.should_receive(:is_local?).and_return(true)
+ service.impl_class.should_receive(:execute).with(:arg1, :arg2).and_return(result = mock("ResultMock"))
+
+ service.execute(:arg1, :arg2).should be(result)
end
it "should call the remote service if impl-class does not exist" do
service = Service.new("test_service_without_impl") { |p1, p2| returns :nothing }
\ No newline at end of file