Sha256: f4d45cde2b03962d4246a8681cc6a813bd994b3f99d96f12784798b830ca1789

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

require File.expand_path(File.join(__FILE__,'..','..','test_helper'))

module NewRelic
  class LatestChangesTest < MiniTest::Test
    def setup
      # 1.8.7 returns relative paths for __FILE__. test:env environment then
      # can't find the CHANGELOG since current dir is test app instead of gem.
      #
      # This doesn't impact production usage of NewRelic::LatestChanges on
      # the gem post-installation, since that's run in our gem's context. So
      # just fix up the pathing in the test for finding default changelog.
      if RUBY_VERSION < '1.9.1'
        NewRelic::LatestChanges.stubs(:default_changelog).returns(File.join(File.dirname(__FILE__), '..', '..', 'CHANGELOG.md'))
      end
    end

    def test_read_default_changelog
      result = NewRelic::LatestChanges.read
      assert_match(/# New Relic Ruby Agent Release Notes #/, result)
      assert_match(/## v\d\.\d{1,2}\.\d{1,2} ##/, result)
    end

    def test_latest_changes_from_fakechangelog
      result = NewRelic::LatestChanges.read(File.join(File.dirname(__FILE__), 'FAKECHANGELOG'))
      assert_match(/3.7.2/, result)
    end

    def test_patch_latest_changes_from_fakechangelog
      result = NewRelic::LatestChanges.read_patch('3.7.2.4242', File.join(File.dirname(__FILE__), 'FAKECHANGELOG'))
      expected = <<END
## v3.7.2.4242 ##

* Patch (3.7.2.4242)

  Patch for something
END
      assert_equal expected, result
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-3.18.1.330 test/new_relic/latest_changes_test.rb
newrelic_rpm-3.18.0.329 test/new_relic/latest_changes_test.rb
newrelic_rpm-3.17.2.327 test/new_relic/latest_changes_test.rb