Skip to content

Commit 2509e7d

Browse files
committed
#542 create spec for testing windows temp directory problem, spec fails
1 parent 33b3810 commit 2509e7d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

spec/actions/directory_spec.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require "tmpdir"
12
require "helper"
23
require "thor/actions"
34

@@ -146,6 +147,28 @@ def exists_and_identical?(source_path, destination_path)
146147
content = invoke!("app{1}")
147148
expect(content).to match(%r{create app\{1\}/README})
148149
end
150+
151+
context 'windows temp directories', :if => windows? do
152+
before(:each) { @temp_dir = Dir.mktmpdir("thor") }
153+
it "works with windows temp dir" do
154+
puts @temp_dir
155+
old_invoker = @invoker
156+
@invoker = WhinyGenerator.new([1, 2], {}, :destination_root => @temp_dir)
157+
begin
158+
invoke! "doc", "docs"
159+
file = File.join(@temp_dir, "docs", "components")
160+
expect(File.exist?(file)).to be true
161+
expect(File.directory?(file)).to be true
162+
ensure
163+
@invoker = old_invoker
164+
end
165+
source_root = File.join(@temp_dir, "docs")
166+
invoke! source_root, "docs"
167+
file = File.join(destination_root, "docs", "components")
168+
expect(File.exist?(file)).to be true
169+
expect(File.directory?(file)).to be true
170+
end
171+
end
149172
end
150173

151174
describe "#revoke!" do

0 commit comments

Comments
 (0)