Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Fix rake task arg quoting on Windows. #1887

Merged
merged 1 commit into from
Feb 26, 2015
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: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Enhancements:
Bug Fixes:

* Handle invalid UTF-8 strings within exception methods. (Benjamin Fleischer, #1760)
* Fix Rake Task quoting of file names with quotes to work properly on
Windows. (Myron Marston, #1887

### 3.2.1 / 2015-02-23
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.0...v3.2.1)
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/core/rake_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def file_inclusion_specification

if RSpec::Support::OS.windows?
def escape(shell_command)
"'#{shell_command.gsub("'", "\'")}'"
"'#{shell_command.gsub("'", "\\\\'")}'"
end
else
require 'shellwords'
Expand Down
7 changes: 7 additions & 0 deletions spec/rspec/core/rake_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ def spec_command
end
end

context "on windows, with a quote in the name", :if => RSpec::Support::OS.windows? do
it "renders rspec quoted, with quote escaped" do
task.rspec_path = "/foo'bar/exe/rspec"
expect(spec_command).to include(%q|'/foo\'bar/exe/rspec'|)
end
end

context "with ruby options" do
it "renders them before the rspec path" do
task.ruby_opts = "-w"
Expand Down