Skip to content

Remove empty line with trailing space at the end of routes map #483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/annotate/annotate_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def remove_annotations(options={})
end

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

# In old versions of Rake, the first line of output was the cwd. Not so
# much in newer ones. We ditch that line if it exists, and if not, we
Expand Down
4 changes: 2 additions & 2 deletions spec/annotate/annotate_routes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def mock_file(stubs = {})
expect(File).to receive(:exists?).with(ROUTE_FILE).and_return(true)

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

expect(AnnotateRoutes).to receive(:puts).with(ANNOTATION_ADDED)
end
Expand Down