Commit 6f62d0e6 by Jon Frisby

Rename AnnotateRoutes.do_annotate to AnnotateRoutes.do_annotations for consistency.

parent d47092e7
......@@ -20,7 +20,7 @@
module AnnotateRoutes
PREFIX = "# == Route Map"
def self.do_annotate(options={})
def self.do_annotations(options={})
return unless(routes_exists?)
if options[:require]
......
......@@ -7,7 +7,7 @@ task :annotate_routes => :environment do
ENV['position'] = options[:position] = Annotate.fallback(ENV['position'], 'before')
options[:position_in_routes] = Annotate.fallback(ENV['position_in_routes'], ENV['position'])
options[:require] = ENV['require'] ? ENV['require'].split(',') : []
AnnotateRoutes.do_annotate(options)
AnnotateRoutes.do_annotations(options)
end
desc "Removes the route map from routes.rb"
......
......@@ -10,7 +10,7 @@ describe AnnotateRoutes do
it "should check if routes.rb exists" do
File.should_receive(:exists?).with("config/routes.rb").and_return(false)
AnnotateRoutes.should_receive(:puts).with("Can`t find routes.rb")
AnnotateRoutes.do_annotate
AnnotateRoutes.do_annotations
end
describe "When Annotating, with older Rake Versions" do
......@@ -25,13 +25,13 @@ describe AnnotateRoutes do
it "should annotate and add a newline!" do
File.should_receive(:read).with("config/routes.rb").and_return("ActionController::Routing...\nfoo")
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map \(Updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}\)\n#\n# good line\n/)
AnnotateRoutes.do_annotate
AnnotateRoutes.do_annotations
end
it "should not add a newline if there are empty lines" do
File.should_receive(:read).with("config/routes.rb").and_return("ActionController::Routing...\nfoo\n")
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map \(Updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}\)\n#\n# good line\n/)
AnnotateRoutes.do_annotate
AnnotateRoutes.do_annotations
end
end
......@@ -48,13 +48,13 @@ describe AnnotateRoutes do
it "should annotate and add a newline!" do
File.should_receive(:read).with("config/routes.rb").and_return("ActionController::Routing...\nfoo")
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map \(Updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}\)\n#\n# another good line\n# good line\n/)
AnnotateRoutes.do_annotate
AnnotateRoutes.do_annotations
end
it "should not add a newline if there are empty lines" do
File.should_receive(:read).with("config/routes.rb").and_return("ActionController::Routing...\nfoo\n")
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map \(Updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}\)\n#\n# another good line\n# good line\n/)
AnnotateRoutes.do_annotate
AnnotateRoutes.do_annotations
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment