Sha256: 18d9494301c99498367043186e9e32e342df5ae1150606617aa94e0552dbba3b

Contents?: true

Size: 1.3 KB

Versions: 3

Compression:

Stored size: 1.3 KB

Contents

require File.dirname(__FILE__) + '/../helper'

module Sappy
  describe Monitor do
    before do
      @account = Account.login("valid@email.com", "password")
      @account.monitors.each { |m| m.destroy }
      @monitor = @account.add_monitor({:name => "New Monitor", :service => "http", :location => "sf", :host => "new-sf-monitor.com", :period => "60"})
    end

    describe "an active monitor" do
      before do
        @monitor.enable!
      end

      it "can be disabled" do
        @monitor.disable!
        @monitor.should.not.be.active
      end
    end

    describe "an inactive monitor" do
      before do
        @monitor.disable!
      end

      it "can be enabled" do
        @monitor.enable!
        @monitor.should.be.active
      end
    end

    describe "a monitor" do
      it "can be destroyed" do
        FakeWeb.register_uri(:get, "https://siteuptime.com/api/rest/?AuthKey=b7kks5mh1l300v5segaksm8gh3&method=siteuptime.monitors", :response => cached_page('monitors_1'))
        @account.monitors.size.should == 1
        lambda { @monitor.destroy }.should.not.raise
        FakeWeb.register_uri(:get, "https://siteuptime.com/api/rest/?AuthKey=b7kks5mh1l300v5segaksm8gh3&method=siteuptime.monitors", :response => cached_page('monitors'))
        @account.monitors.size.should == 0
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
abcde-sappy-0.1.0 spec/sappy/monitor_bacon.rb
abcde-sappy-0.1.1 spec/sappy/monitor_bacon.rb
sappy-0.1.1 spec/sappy/monitor_bacon.rb