Sha256: 387bd5ed3e570285245d6837a46262eba42eba0153a28e4454fdedaaee17edd4

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 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 notify.io 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::Notifyio).post(config['email'], config['api_key'], notifier.short_message, notifier.full_message)

        notifier.deliver!
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
integrity-notifyio-0.2.3 test/integrity-notifyio_test.rb
integrity-notifyio-0.2.1 test/integrity-notifyio_test.rb
integrity-notifyio-0.2.0 test/integrity-notifyio_test.rb
integrity-notifyio-0.1.6 test/integrity-notifyio_test.rb
integrity-notifyio-0.1.5 test/integrity-notifyio_test.rb
integrity-notifyio-0.1.4 test/integrity-notifyio_test.rb