Sha256: 867b7f9b2e56631e913f24eb3e673658a641fdd5e824a79855213ae274d319b8

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

require_relative './test_xml_generator'

class TestXmlEmailPublisher < Test::Unit::TestCase
  def test_postbuild_email_publisher
    builder = JenkinsJob::Builder.new

    builder.freestyle 'foo' do
      postbuild do
        send_email 'test@example.com' do
          notify_every_unstable_build false
          send_to_individuals true
        end
      end
    end

    actual = builder.config_as_xml_node('foo')

    { 'recipients' => 'test@example.com',
      'dontNotifyEveryUnstableBuild' => 'true',
      'sendToIndividuals' => 'true'
     }.each do |k, v|
       assert_equal v, actual.xpath("./project/publishers/hudson.tasks.Mailer/#{k}").text, k
     end
  end

  def test_postbuild_email_publisher_defaults
    builder = JenkinsJob::Builder.new

    builder.freestyle 'foo' do
      postbuild do
        send_email 'test@example.com'
      end
    end

    actual = builder.config_as_xml_node('foo')

    { 'recipients' => 'test@example.com',
      'dontNotifyEveryUnstableBuild' => 'false',
      'sendToIndividuals' => 'false'
     }.each do |k, v|
       assert_equal v, actual.xpath("./project/publishers/hudson.tasks.Mailer/#{k}").text, k
     end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubyjobbuilderdsl-0.0.5 test/test_email_publisher.rb
rubyjobbuilderdsl-0.0.3 test/test_email_publisher.rb
rubyjobbuilderdsl-0.0.2 test/test_email_publisher.rb
rubyjobbuilderdsl-0.0.1 test/test_email_publisher.rb
rubyjobbuilderdsl-0.0.0 test/test_email_publisher.rb