X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Funit%2Fdata%2Fbase_spec.rb;fp=spec%2Funit%2Fdata%2Fbase_spec.rb;h=0000000000000000000000000000000000000000;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=80a150438fe8cc7ee68dd68c3dc570e999bbb095;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/spec/unit/data/base_spec.rb b/spec/unit/data/base_spec.rb deleted file mode 100644 index 80a1504..0000000 --- a/spec/unit/data/base_spec.rb +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env rspec - -require 'spec_helper' - -module MCollective - module Data - describe Base do - before do - @ddl = mock - @ddl.stubs(:dataquery_interface).returns({:output => {'rspec' => {}}}) - @ddl.stubs(:meta).returns({:timeout => 1}) - end - - describe "#initialize" do - it "should set the plugin name, ddl and timeout and call the startup hook" do - DDL.stubs(:new).returns(@ddl) - Base.any_instance.expects(:startup_hook).once - plugin = Base.new - plugin.name.should == "base" - plugin.timeout.should == 1 - plugin.result.class.should == Result - end - end - - describe "#lookup" do - before do - DDL.stubs(:new).returns(@ddl) - @plugin = Base.new - end - - it "should validate the request" do - @plugin.expects(:ddl_validate).with("hello world").returns(true) - @plugin.stubs(:query_data) - @plugin.lookup("hello world") - end - - it "should query the plugin" do - @plugin.stubs(:ddl_validate) - @plugin.expects(:query_data).with("hello world") - @plugin.lookup("hello world").class.should == Result - end - - it "should raise MsgTTLExpired errors for Timeout errors" do - @plugin.stubs(:ddl_validate) - @plugin.expects(:query_data).raises(Timeout::Error) - - msg = "Data plugin base timed out on query 'hello world'" - Log.expects(:error).with(msg) - expect { @plugin.lookup("hello world") }.to raise_error(msg) - end - end - - describe "#query" do - it "should create a new method" do - class Rspec_data