Permalink
Browse files

Rename #enable_notifiers to #update_notifiers

  • Loading branch information...
sr committed Mar 29, 2009
1 parent 40165ec commit 637f94b13c57495af52287995a5fd4867cf9e786
Showing with 10 additions and 10 deletions.
  1. +1 −1 lib/integrity/helpers/resources.rb
  2. +1 −1 lib/integrity/notifier.rb
  3. +2 −2 lib/integrity/project.rb
  4. +6 −6 test/unit/notifier_test.rb
@@ -11,7 +11,7 @@ def current_commit
def update_notifiers_of(project)
if params["notifiers"]
- project.enable_notifiers(params["notifiers"].keys, params["notifiers"])
+ project.update_notifiers(params["notifiers"].keys, params["notifiers"])
end
end
end
@@ -18,7 +18,7 @@ def self.available
constants.map { |name| const_get(name) }.select { |notifier| valid_notifier?(notifier) }
end
- def self.enable_notifiers(project, enabled, config={})
+ def self.update_notifiers(project, enabled, config={})
all(:project_id => project).destroy!
list_of_enabled_notifiers(enabled).each do |name|
create! :project_id => project, :name => name, :config => config[name]
View
@@ -94,8 +94,8 @@ def notifies?(notifier)
!notifiers.first(:name => notifier.to_s.split(/::/).last, :project_id => id).blank?
end
- def enable_notifiers(*args)
- Notifier.enable_notifiers(id, *args)
+ def update_notifiers(*args)
+ Notifier.update_notifiers(id, *args)
end
private
View
@@ -81,11 +81,11 @@ class NotifierTest < Test::Unit::TestCase
irc.notify_of_build(build)
end
- describe "Enabling a list of notifiers for a project" do
+ describe "Updating notifiers of a project" do
it "creates new notifiers for the project" do
project = Project.generate
lambda do
- project.enable_notifiers(["IRC", "Twitter"],
+ project.update_notifiers(["IRC", "Twitter"],
{"IRC" => {"uri" => "irc://irc.freenode.net/integrity"},
"Twitter" => {"username" => "john"}})
end.should change(project.notifiers, :count).from(0).to(2)
@@ -94,23 +94,23 @@ class NotifierTest < Test::Unit::TestCase
it "deletes all of previous notifiers" do
project = Project.generate(:notifiers => [Notifier.gen(:irc), Notifier.gen(:twitter)])
lambda do
- project.enable_notifiers("IRC", {"IRC" => {:foo => "bar"}})
+ project.update_notifiers("IRC", {"IRC" => {:foo => "bar"}})
project.reload
end.should change(project.notifiers, :count).from(2).to(1)
end
it "does nothing if given nil as the list of notifiers to enable" do
- lambda { Project.gen.enable_notifiers(nil, {}) }.should_not change(Notifier, :count)
+ lambda { Project.gen.update_notifiers(nil, {}) }.should_not change(Notifier, :count)
end
it "doesn't destroy any of the other notifiers that exist for other projects" do
irc = Notifier.generate(:irc)
project = Project.gen
- project.enable_notifiers("IRC", {"IRC" => irc.config})
+ project.update_notifiers("IRC", {"IRC" => irc.config})
lambda do
- Project.gen.enable_notifiers("IRC", {"IRC" => irc.config})
+ Project.gen.update_notifiers("IRC", {"IRC" => irc.config})
end.should_not change(project.notifiers, :count)
end
end

0 comments on commit 637f94b

Please sign in to comment.