[refs #114] clean
This commit is contained in:
parent
f15cb90b87
commit
aa9652409c
|
@ -1,6 +1,6 @@
|
||||||
class AddStatusToSubscribe < ActiveRecord::Migration
|
class AddStatusToSubscribe < ActiveRecord::Migration
|
||||||
def self.up
|
def self.up
|
||||||
add_column :subscribes, :status, :integer, :default => 1
|
add_column :subscribes, :status, :boolean, :default => true
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
class ChangeStatusSubscribes < ActiveRecord::Migration
|
|
||||||
def self.up
|
|
||||||
remove_column :subscribes, :status
|
|
||||||
add_column :subscribes, :status, :boolean, :default => true
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.down
|
|
||||||
remove_column :subscribes, :status
|
|
||||||
add_column :subscribes, :status, :integer, :default => 1
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20120130111133) do
|
ActiveRecord::Schema.define(:version => 20120127234602) do
|
||||||
|
|
||||||
create_table "arches", :force => true do |t|
|
create_table "arches", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
|
|
|
@ -155,11 +155,8 @@ describe Comment do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@user = Factory(:user)
|
@user = Factory(:user)
|
||||||
@stranger = Factory(:user)
|
@stranger = Factory(:user)
|
||||||
|
|
||||||
set_comments_data_for_commit
|
set_comments_data_for_commit
|
||||||
|
|
||||||
@project.update_attribute(:owner, @user)
|
@project.update_attribute(:owner, @user)
|
||||||
#@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'admin')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should create comment' do
|
it 'should create comment' do
|
||||||
|
@ -204,7 +201,7 @@ describe Comment do
|
||||||
@user.notifier.update_attribute :new_comment_commit_owner, false
|
@user.notifier.update_attribute :new_comment_commit_owner, false
|
||||||
comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project,
|
comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project,
|
||||||
:commentable_type => @commit.class.name, :commentable_id => @commit.id)
|
:commentable_type => @commit.class.name, :commentable_id => @commit.id)
|
||||||
ActionMailer::Base.deliveries.count.should == 1 # cache project.commit_comments_subscribes ...
|
ActionMailer::Base.deliveries.count.should == 1
|
||||||
ActionMailer::Base.deliveries.last.to.include?(@user.email).should == true
|
ActionMailer::Base.deliveries.last.to.include?(@user.email).should == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -215,7 +212,7 @@ describe Comment do
|
||||||
@user.notifier.update_attribute :new_comment_commit_commentor, false
|
@user.notifier.update_attribute :new_comment_commit_commentor, false
|
||||||
comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project,
|
comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project,
|
||||||
:commentable_type => @commit.class.name, :commentable_id => @commit.id)
|
:commentable_type => @commit.class.name, :commentable_id => @commit.id)
|
||||||
ActionMailer::Base.deliveries.count.should == 1 # cache project.commit_comments_subscribes ...
|
ActionMailer::Base.deliveries.count.should == 1
|
||||||
ActionMailer::Base.deliveries.last.to.include?(@user.email).should == true
|
ActionMailer::Base.deliveries.last.to.include?(@user.email).should == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -320,7 +317,6 @@ describe Comment do
|
||||||
@project.owner.notifier.update_attribute :can_notify, false
|
@project.owner.notifier.update_attribute :can_notify, false
|
||||||
@stranger.notifier.update_attribute :new_comment_commit_repo_owner, false
|
@stranger.notifier.update_attribute :new_comment_commit_repo_owner, false
|
||||||
@stranger.notifier.update_attribute :new_comment_commit_owner, false
|
@stranger.notifier.update_attribute :new_comment_commit_owner, false
|
||||||
#@stranger.notifier.update_attribute :new_comment_commit_commentor, false
|
|
||||||
|
|
||||||
Subscribe.subscribe_to_commit(:project_id => @project.id, :subscribeable_id => @commit.id, :subscribeable_type => @commit.class.name, :user_id => @stranger.id)
|
Subscribe.subscribe_to_commit(:project_id => @project.id, :subscribeable_id => @commit.id, :subscribeable_type => @commit.class.name, :user_id => @stranger.id)
|
||||||
comment = Comment.create(:user => @project.owner, :body => 'hello!', :project => @project,
|
comment = Comment.create(:user => @project.owner, :body => 'hello!', :project => @project,
|
||||||
|
@ -331,7 +327,6 @@ describe Comment do
|
||||||
|
|
||||||
it 'should not send an e-mail for own comment' do
|
it 'should not send an e-mail for own comment' do
|
||||||
ActionMailer::Base.deliveries = []
|
ActionMailer::Base.deliveries = []
|
||||||
#@project.owner.notifier.update_attribute :can_notify, false
|
|
||||||
Subscribe.subscribe_to_commit(:project_id => @project.id, :subscribeable_id => @commit.id, :subscribeable_type => @commit.class.name, :user_id => @stranger.id)
|
Subscribe.subscribe_to_commit(:project_id => @project.id, :subscribeable_id => @commit.id, :subscribeable_type => @commit.class.name, :user_id => @stranger.id)
|
||||||
comment = Comment.create(:user => @owner, :body => 'hello!', :project => @project,
|
comment = Comment.create(:user => @owner, :body => 'hello!', :project => @project,
|
||||||
:commentable_type => @commit.class.name, :commentable_id => @commit.id)
|
:commentable_type => @commit.class.name, :commentable_id => @commit.id)
|
||||||
|
@ -361,7 +356,6 @@ describe Comment do
|
||||||
|
|
||||||
it 'should not send an e-mail for own comment' do
|
it 'should not send an e-mail for own comment' do
|
||||||
ActionMailer::Base.deliveries = []
|
ActionMailer::Base.deliveries = []
|
||||||
#@project.owner.notifier.update_attribute :can_notify, false
|
|
||||||
@stranger.update_attribute :email, 'code@tpope.net'
|
@stranger.update_attribute :email, 'code@tpope.net'
|
||||||
comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project,
|
comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project,
|
||||||
:commentable_type => @commit.class.name, :commentable_id => @commit.id)
|
:commentable_type => @commit.class.name, :commentable_id => @commit.id)
|
||||||
|
|
Loading…
Reference in New Issue