Sha256: 699d1d6bd1647ebce9498f532432ce6c84d6b2cddabdf3feae799f7ea408faeb

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require 'spec/spec_helper'

describe Deputy do
  it "has a VERSION" do
    Deputy::VERSION.should =~ /^\d+\.\d+\.\d+$/
  end

  def klass(name, code='')
    "class #{name} < Scout::Plugin; def build_report; #{code}; end; end"
  end

  describe Scout do
    it "finds plugins" do
      Scout.plugins(klass('A')).inspect.should == '[A]'
    end

    it "does not show non-plugins" do
      Scout.plugins(klass('B').sub('build_report','foo')).inspect.should == '[]'
    end
  end

  describe :run_plugins do
    it "executes all plugins" do
      $notify = 0
      Deputy.stub!(:sheriff_url).and_return 'http://sheri.ff'
      FakeWeb.register_uri(:get, "http://sheri.ff/plugins.rb", :body => klass('C', '$notify=1'))
      Deputy.run_plugins
      $notify.should == 1
    end
  end

  describe :send_report do
    it "sends a report" do
      Deputy.stub!(:sheriff_url).and_return 'http://sheri.ff'
      FakeWeb.register_uri(:get, "http://sheri.ff/report/Xxx.yyy/123", :body => 'OK')
      Deputy.send_report('Xxx.yyy', '123').should == 'OK'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deputy-0.1.3 spec/deputy_spec.rb
deputy-0.1.2 spec/deputy_spec.rb
deputy-0.1.1 spec/deputy_spec.rb