X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Funit%2Fddl%2Fdataddl_spec.rb;fp=spec%2Funit%2Fddl%2Fdataddl_spec.rb;h=0000000000000000000000000000000000000000;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=915cabca4a0cf310877fcb96aea22b8bda7c5f14;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/spec/unit/ddl/dataddl_spec.rb b/spec/unit/ddl/dataddl_spec.rb deleted file mode 100644 index 915cabc..0000000 --- a/spec/unit/ddl/dataddl_spec.rb +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env rspec - -require 'spec_helper' - -module MCollective - module DDL - describe DataDDL do - before :each do - Cache.delete!(:ddl) rescue nil - @ddl = DDL.new("rspec", :data, false) - @ddl.metadata(:name => "name", :description => "description", :author => "author", :license => "license", :version => "version", :url => "url", :timeout => "timeout") - end - - describe "#input" do - it "should only allow 'query' as input for data plugins" do - ddl = DDL.new("rspec", :data, false) - ddl.dataquery(:description => "rspec") - ddl.instance_variable_set("@current_entity", :query) - ddl.instance_variable_set("@plugintype", :data) - - expect { ddl.input(:rspec, {}) }.to raise_error("The only valid input name for a data query is 'query'") - end - end - - describe "#dataquery_interface" do - it "should return the correct data" do - input = {:prompt => "Matcher", :description => "Augeas Matcher", :type => :string, :validation => /.+/, :maxlength => 0} - output = {:description=>"rspec", :display_as=>"rspec", :default => nil} - - @ddl.instance_variable_set("@plugintype", :data) - @ddl.dataquery(:description => "rspec") do - @ddl.output :rspec, output - @ddl.input :query, input - end - - @ddl.dataquery_interface.should == {:description => "rspec", - :input => {:query => input.merge(:optional => nil, :default => nil)}, - :output => {:rspec => output}} - end - end - - describe "#dataquery" do - it "should ensure a description is set" do - expect { @ddl.dataquery({}) }.to raise_error("Data queries need a :description") - end - - it "should ensure only one definition" do - @ddl.dataquery(:description => "rspec") - - expect { @ddl.dataquery(:description => "rspec") }.to raise_error("Data queries can only have one definition") - end - - it "should create the default structure" do - @ddl.dataquery(:description => "rspec") - @ddl.instance_variable_set("@plugintype", :data) - @ddl.dataquery_interface.should == {:description => "rspec", :input => {}, :output => {}} - end - - it "should call the block if given" do - @ddl.dataquery(:description => "rspec") { @ddl.instance_variable_get("@current_entity").should == :data } - end - end - end - end -end