Commit a538dc26 authored by Marin Jankovski's avatar Marin Jankovski

Add missing end in group.rb

Fix redmine issue tracker tests, fix typos. Make sure all fields exist for jira tracker.
parent 10b37239
......@@ -95,6 +95,7 @@ class Group < Namespace
def ldap_synced?
ldap_cn.present?
end
def post_create_hook
system_hook_service.execute_hooks_for(self, :create)
......
......@@ -383,6 +383,14 @@ class Project < ActiveRecord::Base
@ci_service ||= ci_services.select(&:activated?).first
end
def jira_tracker?
issues_tracker.to_param == 'jira'
end
def redmine_tracker?
issues_tracker.to_param == 'redmine'
end
def avatar_type
unless self.avatar.image?
self.errors.add :avatar, 'only images allowed'
......
class JiraService < IssueTrackerService
include HTTParty
prop_accessor :username, :password, :api_version, :jira_issue_transition_id
prop_accessor :username, :password, :api_version, :jira_issue_transition_id,
:title, :description, :project_url, :issues_url, :new_issue_url
validates :username, :password, presence: true, if: :activated?
before_validation :set_api_version
def title
......@@ -29,12 +27,12 @@ class JiraService < IssueTrackerService
end
def fields
[
super.push(
{ type: 'text', name: 'username', placeholder: '' },
{ type: 'password', name: 'password', placeholder: '' },
{ type: 'text', name: 'api_version', placeholder: '2' },
{ type: 'text', name: 'jira_issue_transition_id', placeholder: '2' }
]
)
end
def set_api_version
......
......@@ -9,10 +9,6 @@ module Files
return error("You are not allowed to create file in this branch")
end
unless repository.branch_names.include?(ref)
return error("You can only create files if you are on top of a branch")
end
if git_hook && !git_hook.commit_message_allowed?(params[:commit_message])
return error("Commit message must match next format: #{git_hook.commit_message_regex}")
end
......
......@@ -298,7 +298,7 @@ describe GitlabMarkdownHelper do
before do
jira = @project.create_jira_service if @project.jira_service.nil?
properties = {"title"=>"JIRA tracker", "project_url"=>"http://jira.example/issues/?jql=project=A", "issues_url"=>"http://jira.example/browse/:id", "new_issue_url"=>"http://jira.example/secure/CreateIssue.jspa"}
properties = {"title"=>"JIRA tracker", "project_url"=>"http://jira.example/issues/?jql=project=A", "issues_url"=>"http://jira.example/browse/JIRA-1", "new_issue_url"=>"http://jira.example/secure/CreateIssue.jspa"}
jira.update_attributes(properties: properties, active: true)
end
......@@ -346,10 +346,13 @@ describe GitlabMarkdownHelper do
let(:reference) { "##{issue.iid}" }
before do
issue_tracker_config = { "redmine" => { "title" => "Redmine tracker", "issues_url" => "http://redmine.example/issues/:id" } }
Gitlab.config.stub(:issues_tracker).and_return(issue_tracker_config)
@project.stub(:issues_tracker).and_return("redmine")
@project.stub(:issues_tracker_id).and_return("REDMINE")
redmine = @project.create_redmine_service if @project.redmine_service.nil?
properties = {"title"=>"Redmine", "project_url"=>"http://redmine.example/projects/A", "issues_url"=>"http://redmine.example/issues/:id", "new_issue_url"=>"http://redmine.example/projects/A/issues/new"}
redmine.update_attributes(properties: properties, active: true)
end
after do
@project.redmine_service.destroy! unless @project.redmine_service.nil?
end
it "should link using a valid id" do
......@@ -377,7 +380,7 @@ describe GitlabMarkdownHelper do
end
it "should include a title attribute" do
title = "Issue in Redmine tracker"
title = "Issue in Redmine"
gfm(actual).should match(/title="#{title}"/)
end
......
......@@ -41,6 +41,8 @@ describe JiraService do
WebMock.should have_requested(:post, @api_url).with(
body: /this-is-a-custom-id/
).once
end
end
describe "Validations" do
context "active" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment