summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLong Nguyen <long.polyglot@gmail.com>2016-05-21 17:20:44 +0700
committerLong Nguyen <long.polyglot@gmail.com>2016-05-21 17:20:44 +0700
commitbfbbb182c14441ad176b6c7b0ec9e9f38da25ae4 (patch)
tree07a099a7752819c84329a15e2e03143d30dd2d4c
parenta263425ff14b3524751d41dc6ac74050a24b8609 (diff)
downloadgitlab-ce-bfbbb182c14441ad176b6c7b0ec9e9f38da25ae4.tar.gz
Fix broken specs
-rw-r--r--app/models/members/project_member.rb3
-rw-r--r--spec/models/members/project_member_spec.rb1
2 files changed, 1 insertions, 3 deletions
diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb
index 0ced9c31581..fa04963a1b7 100644
--- a/app/models/members/project_member.rb
+++ b/app/models/members/project_member.rb
@@ -3,7 +3,6 @@ class ProjectMember < Member
include Gitlab::ShellAdapter
- has_many :todos, through: :user
belongs_to :project, class_name: 'Project', foreign_key: 'source_id'
# Make sure project member points only to project as it source
@@ -15,7 +14,7 @@ class ProjectMember < Member
scope :in_projects, ->(projects) { where(source_id: projects.pluck(:id)) }
scope :with_user, ->(user) { where(user_id: user.id) }
- before_destroy { todos.each(&:destroy) }
+ before_destroy { user.todos.where(project_id: source_id).each(&:destroy) }
class << self
diff --git a/spec/models/members/project_member_spec.rb b/spec/models/members/project_member_spec.rb
index 2d2fa91e001..46e98c8807b 100644
--- a/spec/models/members/project_member_spec.rb
+++ b/spec/models/members/project_member_spec.rb
@@ -21,7 +21,6 @@ require 'spec_helper'
describe ProjectMember, models: true do
describe 'associations' do
- it { is_expected.to have_many(:todos).through(:user) }
it { is_expected.to belong_to(:project).class_name('Project').with_foreign_key(:source_id) }
end