spec/lib/ghn/notification_spec.rb in ghn-2.0.0.pre5 vs spec/lib/ghn/notification_spec.rb in ghn-2.0.0
- old
+ new
@@ -1,11 +1,13 @@
require 'spec_helper'
describe Ghn::Notification do
describe '#type_class' do
- subject { Ghn::Notification.new(notification).type_class }
+ let(:follow_issuecomment) { false }
+ subject { Ghn::Notification.new(notification, follow_issuecomment).type_class }
+
context 'issue' do
let(:notification) { fixture('issue.json') }
it { is_expected.to eq Ghn::IssueNotification }
end
@@ -37,74 +39,98 @@
describe Ghn::IssueNotification do
describe '#url' do
it do
expect(
- Ghn::IssueNotification.new(fixture('issue.json')).url
+ Ghn::IssueNotification.new(fixture('issue.json'), false).url
).to eq 'https://github.com/username/reponame/issues/305'
end
- context 'with comment' do
+ context 'with comment and --follow-issuecomment is turned on' do
it do
expect(
- Ghn::IssueNotification.new(fixture('issue_with_comment.json')).url
+ Ghn::IssueNotification.new(fixture('issue_with_comment.json'), true).url
).to eq 'https://github.com/username/reponame/issues/305#issuecomment-53070200'
end
end
+
+ context 'with comment but --follow-issuecomment is turned off' do
+ it do
+ expect(
+ Ghn::IssueNotification.new(fixture('issue_with_comment.json'), false).url
+ ).to eq 'https://github.com/username/reponame/issues/305'
+ end
+ end
end
end
describe Ghn::PullRequestNotification do
describe '#url' do
it do
expect(
- Ghn::PullRequestNotification.new(fixture('pull_request.json')).url
+ Ghn::PullRequestNotification.new(fixture('pull_request.json'), false).url
).to eq 'https://github.com/username/reponame/pull/22'
end
- context 'with comment' do
+ context 'with comment and --follow-issuecomment is turned on' do
it do
expect(
- Ghn::PullRequestNotification.new(fixture('pull_request_with_comment.json')).url
+ Ghn::PullRequestNotification.new(fixture('pull_request_with_comment.json'), true).url
).to eq 'https://github.com/username/reponame/pull/22#issuecomment-16607215'
end
end
+
+ context 'with comment but --follow-issuecomment is turned off' do
+ it do
+ expect(
+ Ghn::PullRequestNotification.new(fixture('pull_request_with_comment.json'), false).url
+ ).to eq 'https://github.com/username/reponame/pull/22'
+ end
+ end
end
end
describe Ghn::CommitNotification do
describe '#url' do
it do
expect(
- Ghn::CommitNotification.new(fixture('commit.json')).url
+ Ghn::CommitNotification.new(fixture('commit.json'), false).url
).to eq 'https://github.com/username/reponame/commit/6a4a135335acef4dfe15912d231429c07d4ad143'
end
- context 'with comment' do
+ context 'with comment and --follow-issuecomment is turned on' do
it do
expect(
- Ghn::CommitNotification.new(fixture('commit_with_comment.json')).url
+ Ghn::CommitNotification.new(fixture('commit_with_comment.json'), true).url
).to eq 'https://github.com/username/reponame/commit/6a4a135335acef4dfe15912d231429c07d4ad143#issuecomment-7491006'
end
end
+
+ context 'with comment but --follow-issuecomment is turned off' do
+ it do
+ expect(
+ Ghn::CommitNotification.new(fixture('commit_with_comment.json'), false).url
+ ).to eq 'https://github.com/username/reponame/commit/6a4a135335acef4dfe15912d231429c07d4ad143'
+ end
+ end
end
end
describe Ghn::ReleaseNotification do
describe '#url' do
it do
expect(
- Ghn::ReleaseNotification.new(fixture('release.json')).url
+ Ghn::ReleaseNotification.new(fixture('release.json'), false).url
).to eq 'https://github.com/yandod/candycane/releases/tag/v0.9.4'
end
end
end
describe Ghn::UnknownNotification do
describe '#url' do
it do
expect(
- Ghn::UnknownNotification.new(fixture('release.json')).url
+ Ghn::UnknownNotification.new(fixture('release.json'), false).url
).to be nil
end
end
end
end