Skip to content

Commit 330f8bd

Browse files
sashabelozerovctran
authored andcommitted
Remove empty line with trailing space at the end of routes map (#483)
1 parent 6775e4a commit 330f8bd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/annotate/annotate_routes.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def remove_annotations(options={})
7777
end
7878

7979
def self.app_routes_map(options)
80-
routes_map = `rake routes`.split(/\n/, -1)
80+
routes_map = `rake routes`.chomp("\n").split(/\n/, -1)
8181

8282
# In old versions of Rake, the first line of output was the cwd. Not so
8383
# much in newer ones. We ditch that line if it exists, and if not, we

spec/annotate/annotate_routes_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def mock_file(stubs = {})
2222
expect(File).to receive(:exists?).with(ROUTE_FILE).and_return(true)
2323

2424
expect(File).to receive(:read).with(ROUTE_FILE).and_return("")
25-
expect(AnnotateRoutes).to receive(:`).with('rake routes').and_return(' Prefix Verb URI Pattern Controller#Action
25+
expect(AnnotateRoutes).to receive(:`).with('rake routes').and_return(" Prefix Verb URI Pattern Controller#Action
2626
myaction1 GET /url1(.:format) mycontroller1#action
2727
myaction2 POST /url2(.:format) mycontroller2#action
28-
myaction3 DELETE|GET /url3(.:format) mycontroller3#action')
28+
myaction3 DELETE|GET /url3(.:format) mycontroller3#action\n")
2929

3030
expect(AnnotateRoutes).to receive(:puts).with(ANNOTATION_ADDED)
3131
end

0 commit comments

Comments
 (0)