Sha256: 8c78a34b15214803b4005c7cfea0fb0c21bf37fb38c74fc9d097c43082c0a868

Contents?: true

Size: 1003 Bytes

Versions: 1

Compression:

Stored size: 1003 Bytes

Contents

#!/usr/bin/env rspec

require 'spec_helper'

require File.dirname(__FILE__) + "/../../../../../plugins/mcollective/data/collective_data.rb"

module MCollective
  module Data
    describe Collective_data do
      describe "#query_data" do
        before :each do
          @ddl = mock('DDL')
          @ddl.stubs(:dataquery_interface).returns({:output => {}})
          @ddl.stubs(:meta).returns({:timeout => 1})
          DDL.stubs(:new).returns(@ddl)
          @plugin = Collective_data.new

          Config.instance.stubs(:collectives).returns([ "collective_a", "collective_b" ])
        end

        it 'should return true if you are a member of the named collective' do
          @plugin.query_data("collective_a")
          @plugin.result[:member].should == true
        end

        it 'should return false if you are a member of the named collective' do
          @plugin.query_data("no_such_collective")
          @plugin.result[:member].should == false
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mcollective-client-2.7.0 spec/unit/plugins/mcollective/data/collective_data_spec.rb