Sha256: 37cb594369b8f766b6c2677b0eb54a826a22e3487fc0cbdb704395efa0283f57

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe Ghn::Notification do
  subject { Ghn::Notification.new(notification) }

  describe '#to_url' do
    context 'issue' do
      subject { Ghn::Notification.new fixture('issue.json') }

      it { expect(subject.to_url).to eq 'https://github.com/username/reponame/issues/305' }
    end

    context 'issue comment' do
      subject { Ghn::Notification.new fixture('issue_with_comment.json') }

      it { expect(subject.to_url).to eq 'https://github.com/username/reponame/issues/305#issuecomment-53070200' }
    end

    context 'pull request' do
      subject { Ghn::Notification.new fixture('pull_request.json') }

      it { expect(subject.to_url).to eq 'https://github.com/username/reponame/pull/22' }
    end

    context 'pull request with comment' do
      subject { Ghn::Notification.new fixture('pull_request_with_comment.json') }

      it { expect(subject.to_url).to eq 'https://github.com/username/reponame/pull/22#issuecomment-16607215' }
    end

    context 'commit' do
      subject { Ghn::Notification.new fixture('commit.json') }

      it { expect(subject.to_url).to eq 'https://github.com/username/reponame/commit/6a4a135335acef4dfe15912d231429c07d4ad143' }
    end

    context 'commit with comment' do
      subject { Ghn::Notification.new fixture('commit_with_comment.json') }

      it { expect(subject.to_url).to eq 'https://github.com/username/reponame/commit/6a4a135335acef4dfe15912d231429c07d4ad143#issuecomment-7491006' }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ghn-2.0.0.pre1 spec/lib/ghn/notification_spec.rb