#200: removed duplicates of specs
This commit is contained in:
parent
391d5af18d
commit
8a83a4cefa
|
@ -3,7 +3,7 @@ module Modules::Observers::ActivityFeed::Comment
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
after_commit :new_comment_notifications, :on => :create, :unless => :automatic?
|
||||
after_commit :new_comment_notifications, :on => :create
|
||||
# dont remove outdated issues link
|
||||
after_update -> { Comment.create_link_on_issues_from_item(self) }
|
||||
end
|
||||
|
@ -11,6 +11,7 @@ module Modules::Observers::ActivityFeed::Comment
|
|||
private
|
||||
|
||||
def new_comment_notifications
|
||||
return if automatic?
|
||||
if issue_comment?
|
||||
commentable.subscribes.each do |subscribe|
|
||||
if user_id != subscribe.user_id
|
||||
|
|
|
@ -5,5 +5,6 @@ FactoryGirl.define do
|
|||
association :user, :factory => :user
|
||||
association :commentable, :factory => :issue
|
||||
project { |c| c.commentable.project }
|
||||
after(:create) { |c| c.send(:new_comment_notifications) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,5 +7,6 @@ FactoryGirl.define do
|
|||
association :user, :factory => :user
|
||||
association :assignee, :factory => :user
|
||||
status "open"
|
||||
after(:create) { |i| i.send(:new_issue_notifications) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,7 @@ FactoryGirl.define do
|
|||
password '123456'
|
||||
password_confirmation {|u| u.password}
|
||||
confirmed_at { Time.now.utc }
|
||||
after(:create) { |u| u.send(:new_user_notification) }
|
||||
end
|
||||
|
||||
factory :admin, :parent => :user do
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
require 'spec_helper'
|
||||
|
||||
describe Modules::Observers::ActivityFeed::Comment do
|
||||
self.use_transactional_fixtures = false
|
||||
before { stub_symlink_methods }
|
||||
|
||||
it 'sends a notification email after create a issue comment' do
|
||||
comment = FactoryGirl.build(:comment)
|
||||
mailer = mock!.deliver
|
||||
mock(UserMailer).new_comment_notification(comment, comment.commentable.assignee) { mailer }
|
||||
comment.save
|
||||
end
|
||||
end
|
|
@ -1,30 +0,0 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
require 'spec_helper'
|
||||
|
||||
describe Modules::Observers::ActivityFeed::Issue do
|
||||
self.use_transactional_fixtures = false
|
||||
before { stub_symlink_methods }
|
||||
|
||||
it 'sends a notification email after create' do
|
||||
issue = FactoryGirl.build(:issue, :assignee => nil)
|
||||
mailer = mock!.deliver
|
||||
mock(UserMailer).new_issue_notification(issue, issue.project.owner) { mailer }
|
||||
issue.save
|
||||
end
|
||||
|
||||
it 'does not send a notification email after update' do
|
||||
issue = FactoryGirl.create(:issue, :assignee => nil)
|
||||
issue.title = 'new title'
|
||||
dont_allow(UserMailer).new_issue_notification
|
||||
issue.save
|
||||
end
|
||||
|
||||
it 'sends a notification email after a assignee of issue has been changed' do
|
||||
user = FactoryGirl.create(:user)
|
||||
issue = FactoryGirl.build(:issue, :assignee => nil)
|
||||
issue.assignee = user
|
||||
mailer = mock!.deliver
|
||||
mock(UserMailer).issue_assign_notification(issue, user) { mailer }
|
||||
issue.save
|
||||
end
|
||||
end
|
|
@ -37,7 +37,6 @@ def should_not_send_email(args={})
|
|||
end
|
||||
|
||||
describe Comment do
|
||||
self.use_transactional_fixtures = false
|
||||
before { stub_symlink_methods }
|
||||
context 'for global admin user' do
|
||||
before(:each) do
|
||||
|
|
|
@ -19,7 +19,6 @@ def create_comment_in_issue issue, body
|
|||
end
|
||||
|
||||
describe Comment do
|
||||
self.use_transactional_fixtures = false
|
||||
before { stub_symlink_methods }
|
||||
context 'for global admin user' do
|
||||
before(:each) do
|
||||
|
|
|
@ -13,7 +13,6 @@ def create_issue issue_owner
|
|||
end
|
||||
|
||||
describe Issue do
|
||||
self.use_transactional_fixtures = false
|
||||
before do
|
||||
stub_symlink_methods
|
||||
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
||||
|
|
|
@ -30,7 +30,6 @@ RSpec.configure do |config|
|
|||
|
||||
config.before(:all) { init_test_root }
|
||||
config.after(:all) { clear_test_root }
|
||||
config.after(:all) { User.destroy_all }
|
||||
end
|
||||
|
||||
def set_session_for(user=nil)
|
||||
|
|
Loading…
Reference in New Issue