Sha256: 1a91aae428246460d19e96e78c8f73bf9a2c9dcc9d1e4959b6152b753bba16b5

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require 'test_helper'
require 'integrity/notifier/test'
require 'integrity/notifier/notifyio'

begin
  require "redgreen"
rescue LoadError
end

class IntegrityNotifyioTest < Test::Unit::TestCase
  include Integrity::Notifier::Test

  def notifier
    "Notifyio"
  end

  context "A notifyio-based notifier" do
    setup { setup_database }

    should "register itself" do
      assert_equal Integrity::Notifier::Notifyio, 
                   Integrity::Notifier.available["Notifyio"]
    end

    should "have a configuration form" do
      assert_form_have_option "email",    "foo@example.org"
      assert_form_have_option "api_key",  "key123"
    end

    [:successful, :failed, :pending].each do |status|
      should "post a notification to the tumblelog after completing a #{status} build" do
        commit = Integrity::Commit.gen(status)
        config = { :email => "foo@example.org", :api_key => "key123" }
        notifier = Integrity::Notifier::Notifyio.new(commit, config)

        mock(Integrity::Notifier::NotifyioClient).post(config['email'], config['api_key'], notifier.short_message, notifier.full_message)

        notifier.deliver!
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
integrity-notifyio-0.1.3 test/integrity-notifyio_test.rb
integrity-notifyio-0.1.2 test/integrity-notifyio_test.rb
integrity-notifyio-0.1.1 test/integrity-notifyio_test.rb
integrity-notifyio-0.1.0 test/integrity-notifyio_test.rb