Sha256: efb4fcd342a3f95e306668df81dd9c26ced78c0babbad86575c219a5948a656a

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe Safely::Strategy::Hoptoad do

  it "should be configurable" do
    Safely::Strategy::Hoptoad.should respond_to(:hoptoad_key)
    Safely::Strategy::Hoptoad.should respond_to(:hoptoad_key=)
    Safely::Strategy::Hoptoad.should respond_to(:hoptoad_host)
    Safely::Strategy::Hoptoad.should respond_to(:hoptoad_host=)
  end

  it "should send the hoptoad_host when config set" do 
    Safely::Strategy::Hoptoad.hoptoad_key = "foo"
    Safely::Strategy::Hoptoad.hoptoad_host = "http://foo"

    toadhopper_instance = mock(:post!)
    Toadhopper.expects(:new).with("foo", { :notify_host => "http://foo" }).returns(toadhopper_instance)

    safely do
      raise "Argh"
    end
  end

  it "should report when configured" do
    Safely::Strategy::Hoptoad.hoptoad_key = "foo"
    Safely::Strategy::Hoptoad.hoptoad_host = nil

    toadhopper_instance = mock(:post!)
    Toadhopper.expects(:new).with("foo", {}).returns(toadhopper_instance)

    safely do
      raise "Argh"
    end
  end

  it "should not bother when not configured" do
    Safely::Strategy::Hoptoad.hoptoad_key = nil

    Toadhopper.any_instance.expects(:post!).never

    safely do
      raise "Argh"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
safely-0.3.2 spec/strategies/hoptoad_spec.rb