diff --git a/db/migrate/20120123120400_add_status_to_subscribe.rb b/db/migrate/20120123120400_add_status_to_subscribe.rb index 27fef24af..69f24e6f9 100644 --- a/db/migrate/20120123120400_add_status_to_subscribe.rb +++ b/db/migrate/20120123120400_add_status_to_subscribe.rb @@ -1,6 +1,6 @@ class AddStatusToSubscribe < ActiveRecord::Migration def self.up - add_column :subscribes, :status, :integer, :default => 1 + add_column :subscribes, :status, :boolean, :default => true end def self.down diff --git a/db/migrate/20120130111133_change_status_subscribes.rb b/db/migrate/20120130111133_change_status_subscribes.rb deleted file mode 100644 index 9d31898c8..000000000 --- a/db/migrate/20120130111133_change_status_subscribes.rb +++ /dev/null @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 754823099..8c4af8b8f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.string "name", :null => false diff --git a/spec/models/comment_for_commit_spec.rb b/spec/models/comment_for_commit_spec.rb index 7be5c2a06..6f693d03e 100644 --- a/spec/models/comment_for_commit_spec.rb +++ b/spec/models/comment_for_commit_spec.rb @@ -155,11 +155,8 @@ describe Comment do before(:each) do @user = Factory(:user) @stranger = Factory(:user) - set_comments_data_for_commit - @project.update_attribute(:owner, @user) - #@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'admin') end it 'should create comment' do @@ -204,7 +201,7 @@ describe Comment do @user.notifier.update_attribute :new_comment_commit_owner, false comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project, :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 end end @@ -215,7 +212,7 @@ describe Comment do @user.notifier.update_attribute :new_comment_commit_commentor, false comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project, :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 end end @@ -320,7 +317,6 @@ describe Comment do @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_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) 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 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) comment = Comment.create(:user => @owner, :body => 'hello!', :project => @project, :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 ActionMailer::Base.deliveries = [] - #@project.owner.notifier.update_attribute :can_notify, false @stranger.update_attribute :email, 'code@tpope.net' comment = Comment.create(:user => @stranger, :body => 'hello!', :project => @project, :commentable_type => @commit.class.name, :commentable_id => @commit.id)