Skip to content

Commit

Permalink
Rename AnnotateRoutes.do_annotate to AnnotateRoutes.do_annotations fo…
Browse files Browse the repository at this point in the history
…r consistency.
  • Loading branch information
MrJoy committed Aug 27, 2012
1 parent d47092e commit 6f62d0e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/annotate/annotate_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/annotate_routes.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 5 additions & 5 deletions spec/annotate/annotate_routes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def mock_file(stubs={})
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
Expand All @@ -25,13 +25,13 @@ def mock_file(stubs={})
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
Expand All @@ -48,13 +48,13 @@ def mock_file(stubs={})
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
Expand Down

0 comments on commit 6f62d0e

Please sign in to comment.