Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 575f092

Browse files
author
caleb
committed
did a todo item, now event edits can be marked trivial to avoid sending
email to participants. tried to add some tests to test this, but they don't quite work yet git-svn-id: http://svn.pdxruby.org/repos/www/trunk@206 f0fbaf97-c700-0410-a5eb-8ea856f8537e
1 parent aac617a commit 575f092

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ task :default => [ :test_units, :test_functional ]
88
require 'rake'
99
require 'rake/testtask'
1010
require 'rake/rdoctask'
11-
1211
require 'tasks/rails'

app/controllers/events_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def update
8484
end
8585
if @event.update_attributes(params[:event])
8686
flash[:notice] = 'Event was successfully updated.'
87-
MailBot::deliver_change_message(self, @event)
87+
MailBot::deliver_change_message(self, @event) unless params[:trivial]
8888
redirect_to :action => 'show', :id => @event
8989
else
9090
render :action => 'edit'

app/views/events/edit.rhtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
render_partial 'form_ended'
88
end
99
%>
10+
<p><%= check_box_tag 'trivial' %> <label for="trivial_change">Trivial Change</label></p>
1011
<%= submit_tag 'Edit' %>
1112
<%= end_form_tag %>
1213

doc/TODO

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ _Spamming_
1111

1212
- All members are notified of new events
1313

14-
- Should be able to check "minor edit" when editing an event
15-
to avoid spam going to everyone. Ideally, there would be a
16-
preview for textilized fields too.
17-
1814
_Other_
1915

2016
- Bug in location view code when editing an event. Prevented me from

test/functional/events_controller_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,16 @@ def test_destroy
8585
Event.find(1)
8686
}
8787
end
88+
89+
def setup_for_mail_tests
90+
ActionMailer::Base.delivery_method = :test
91+
ActionMailer::Base.perform_deliveries = true
92+
ActionMailer::Base.deliveries = []
93+
end
94+
95+
def test_trivial_change
96+
setup_for_mail_tests
97+
post :update, {"commit"=>"Edit", "event"=>{"minutes"=>"Testing this stupid thing. Dont Send mail."}, "action"=>"update", "id"=>"1", "controller"=>"events", "trivial"=>"1"}
98+
assert ActionMailer::Base.deliveries.empty?
99+
end
88100
end

test/unit/article_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require File.dirname(__FILE__) + '/../test_helper'
22

33
class ArticleTest < Test::Unit::TestCase
4-
fixtures :articles
4+
fixtures :articles, :members
55

66
def setup
77
@article = Article.new

0 commit comments

Comments
 (0)