Skip to content

Commit 979eed5

Browse files
committed
clean up the windows temp dir test and target it against the rspec-rails behavior
1 parent 2509e7d commit 979eed5

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

spec/actions/directory_spec.rb

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def revoke!(*args, &block)
2626

2727
def exists_and_identical?(source_path, destination_path)
2828
%w(config.rb README).each do |file|
29-
source = File.join(source_root, source_path, file)
29+
source = File.join(source_root, source_path, file)
3030
destination = File.join(destination_root, destination_path, file)
3131

3232
expect(File.exist?(destination)).to be true
@@ -149,22 +149,18 @@ def exists_and_identical?(source_path, destination_path)
149149
end
150150

151151
context 'windows temp directories', :if => windows? do
152-
before(:each) { @temp_dir = Dir.mktmpdir("thor") }
152+
let(:spec_dir) { File.join(@temp_dir, "spec") }
153+
154+
before(:each) do
155+
@temp_dir = Dir.mktmpdir("thor")
156+
Dir.mkdir(spec_dir)
157+
File.new(File.join(spec_dir, 'spec_helper.rb'), 'w')
158+
end
159+
160+
after(:each) { FileUtils.rm_rf(@temp_dir) }
153161
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")
162+
invoke! spec_dir, "specs"
163+
file = File.join(destination_root, "specs")
168164
expect(File.exist?(file)).to be true
169165
expect(File.directory?(file)).to be true
170166
end

0 commit comments

Comments
 (0)