summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/github_import
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-03-07 10:36:42 +0100
committerGabriel Mazetto <brodock@gmail.com>2017-03-10 21:08:21 +0100
commit9b53cb6c88f406c947df24debcba0f87c66cbfcf (patch)
tree8874710fb35b8830d500bd68e408d7b05faf34ad /spec/lib/gitlab/github_import
parentc4ba6ea684052ff555e8683c23be5b25bf5abd11 (diff)
downloadgitlab-ce-9b53cb6c88f406c947df24debcba0f87c66cbfcf.tar.gz
Fix GitHub Import for open PRs from a fork
Diffstat (limited to 'spec/lib/gitlab/github_import')
-rw-r--r--spec/lib/gitlab/github_import/pull_request_formatter_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb b/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
index 951cbea7857..af7ed3658a9 100644
--- a/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
+++ b/spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
@@ -306,4 +306,28 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
expect(pull_request.url).to eq 'https://api.github.com/repos/octocat/Hello-World/pulls/1347'
end
end
+
+ describe '#opened?' do
+ let(:raw_data) { double(base_data.merge(state: 'open')) }
+
+ it 'returns true when state is "open"' do
+ expect(pull_request.opened?).to be_truthy
+ end
+ end
+
+ describe '#closed?' do
+ let(:raw_data) { double(base_data.merge(state: 'closed')) }
+
+ it 'returns true when state is "closed"' do
+ expect(pull_request.closed?).to be_truthy
+ end
+ end
+
+ describe '#merged?' do
+ let(:raw_data) { double(base_data.merge(state: 'closed', merged_at: Date.today)) }
+
+ it 'returns true when state is "closed" and merged_at is set' do
+ expect(pull_request.merged?).to be_truthy
+ end
+ end
end