Sha256: aa6a20d4c095b31b3f6e484b96b519f53e5fdbf5df0142ff9df419ee2fb93fa6

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

require "helper"
require "cc/presenters/pull_requests_presenter"

class TestPullRequestsPresenter < CC::Service::TestCase
  def test_message_singular
    assert_equal(
      "Code Climate found 1 new issue and 1 fixed issue.",
      build_presenter("fixed" => 1, "new" => 1).success_message
    )
  end

  def test_message_plural
    assert_equal(
      "Code Climate found 2 new issues and 1 fixed issue.",
      build_presenter("fixed" => 1, "new" => 2).success_message
    )
  end

  def test_message_only_fixed
    assert_equal(
      "Code Climate found 1 fixed issue.",
      build_presenter("fixed" => 1, "new" => 0).success_message
    )
  end

  def test_message_only_new
    assert_equal(
      "Code Climate found 3 new issues.",
      build_presenter("fixed" => 0, "new" => 3).success_message
    )
  end

  def test_message_no_new_or_fixed
    assert_equal(
      "Code Climate didn't find any new or fixed issues.",
      build_presenter("fixed" => 0, "new" => 0).success_message
    )
  end

private

  def build_payload(issue_counts)
    { "issue_comparison_counts" => issue_counts }
  end

  def build_presenter(issue_counts)
    CC::Service::PullRequestsPresenter.new(build_payload(issue_counts))
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
codeclimate-services-1.3.0 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-1.2.0 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-1.1.0 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-1.0.1 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-1.0.0 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-0.6.2 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-0.6.1 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-0.6.0 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-0.5.3 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-0.5.2 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-0.5.1 test/presenters/pull_requests_presenter_test.rb
codeclimate-services-0.5.0 test/presenters/pull_requests_presenter_test.rb