Rspec test repo replaced.\nMerge Requests improved

This commit is contained in:
Dmitriy Zaporozhets 2012-03-13 23:54:49 +02:00
parent 781f5aa6fb
commit 3676838dc9
18 changed files with 90 additions and 41 deletions

View file

@ -12,6 +12,7 @@ class MergeRequest < ActiveRecord::Base
validates_presence_of :author_id
validates_presence_of :source_branch
validates_presence_of :target_branch
validate :validate_branches
delegate :name,
:email,
@ -31,6 +32,13 @@ class MergeRequest < ActiveRecord::Base
scope :closed, where(:closed => true)
scope :assigned, lambda { |u| where(:assignee_id => u.id)}
def validate_branches
if target_branch == source_branch
errors.add :base, "You can not use same branch for source and target branches"
end
end
def new?
today? && created_at == updated_at
end