Commit c4dbbd6880145886e20056f1647b3789f37bcea4

Authored by Jozef Vaclavik
1 parent 72e11032
Exists in master and in 1 other branch production

Gitlab Integration updated model spec

spec/models/issue_trackers/github_issues_tracker_spec 2.rb
... ... @@ -1,30 +0,0 @@
1   -require 'spec_helper'
2   -
3   -describe IssueTrackers::GitlabTracker do
4   - it "should create an issue on Gitlab with problem params" do
5   - notice = Fabricate :notice
6   - tracker = Fabricate :gitlab_tracker, :app => notice.app
7   - problem = notice.problem
8   -
9   - number = 5
10   - @issue_link = "#{tracker.account}/#{tracker.project_id}/issues/#{number}/#{tracker.api_token}"
11   - body = <<EOF
12   -{
13   - "title": "Title"
14   -}
15   -EOF
16   -
17   - stub_request(:post, "#{tracker.account}/#{tracker.project_id}/issues/#{tracker.api_token}").
18   - to_return(:status => 201, :headers => {'Location' => @issue_link}, :body => body )
19   -
20   - problem.app.issue_tracker.create_issue(problem)
21   - problem.reload
22   -
23   - requested = have_requested(:post, "#{tracker.account}/#{tracker.project_id}/issues/#{tracker.api_token}")
24   - WebMock.should requested.with(:body => /[production][foo#bar] FooError: Too Much Bar/)
25   - WebMock.should requested.with(:body => /See this exception on Errbit/)
26   -
27   - problem.issue_link.should == @issue_link
28   - end
29   -end
30   -
spec/models/issue_trackers/gitlab_issues_tracker_spec.rb 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +require 'spec_helper'
  2 +
  3 +describe IssueTrackers::GitlabTracker do
  4 + it "should create an issue on Gitlab with problem params" do
  5 + notice = Fabricate :notice
  6 + tracker = Fabricate :gitlab_tracker, :app => notice.app
  7 + problem = notice.problem
  8 +
  9 + number = 5
  10 + @issue_link = "#{tracker.account}/api/v3/projects/#{tracker.project_id}/issues/#{number}/?private_token=#{tracker.api_token}"
  11 + body = <<EOF
  12 +{
  13 + "title": "Title"
  14 +}
  15 +EOF
  16 +
  17 + stub_request(:post, "#{tracker.account}/api/v3/projects/#{tracker.project_id}/issues/?private_token=#{tracker.api_token}").
  18 + to_return(:status => 201, :headers => {'Location' => @issue_link}, :body => body )
  19 +
  20 + problem.app.issue_tracker.create_issue(problem)
  21 + problem.reload
  22 +
  23 + requested = have_requested(:post, "#{tracker.account}/api/v3/projects/#{tracker.project_id}/issues/?private_token=#{tracker.api_token}")
  24 + WebMock.should requested.with(:body => /[production][foo#bar] FooError: Too Much Bar/)
  25 + WebMock.should requested.with(:body => /See this exception on Errbit/)
  26 +
  27 + problem.issue_link.should == @issue_link
  28 + end
  29 +end
  30 +
... ...