Skip to content

Commit 9def3ed

Browse files
committed
Immutable clone test.
1 parent 16c795a commit 9def3ed

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

fixtures/teapot/command/a_clone.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
require "sus/shared"
77
require "build/files"
88

9+
require "sus/fixtures/temporary_directory_context"
10+
911
module Teapot
1012
module Command
1113
# Scratch directory used by clone integration tests.
1214
# The test deletes and recreates this directory during the run.
13-
AClone = Sus::Shared("teapot/command/clone fixture") do
14-
let(:root) {::Build::Files::Path.new(File.expand_path("clone", __dir__))}
15+
AClone = Sus::Shared("a clone") do
16+
include Sus::Fixtures::TemporaryDirectoryContext
17+
18+
let(:template_root) {::Build::Files::Path.new(File.expand_path("clone", __dir__))}
1519
end
1620
end
1721
end

fixtures/teapot/command/a_fetch.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ module Command
1313
AFetch = Sus::Shared("a fetch") do
1414
include Sus::Fixtures::TemporaryDirectoryContext
1515

16-
let(:fetch_root) {::Build::Files::Path.new(File.expand_path("fetch", __dir__))}
16+
let(:template_root) {::Build::Files::Path.new(File.expand_path("fetch", __dir__))}
1717

1818
before do
19-
FileUtils.cp_r(File.join(fetch_root, "test-project"), root)
19+
FileUtils.cp_r(File.join(template_root, "test-project"), root)
2020
end
2121
end
2222
end

test/teapot/command/clone.rb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,20 @@
77
require "teapot/command/a_clone"
88

99
describe Teapot::Command::Clone do
10-
include_context Teapot::Command::AClone
10+
include Teapot::Command::AClone
1111

1212
let(:source) {"https://github.com/kurocha/tagged-format"}
1313

14-
let(:top) {Teapot::Command::Top["--root", root.to_s]}
15-
16-
before do
17-
root.delete
18-
end
14+
let(:project_root) {File.join(root, "project")}
15+
let(:top) {Teapot::Command::Top["--root", project_root.to_s]}
1916

2017
with "clone remote source" do
21-
let(:subject) {top["clone", source]}
18+
let(:subject) {top["clone", template_root.to_s]}
2219

2320
it "should checkout files" do
2421
subject.call
2522

26-
expect(File).to be(:exist?, root + "teapot.rb")
23+
expect(File).to be(:exist?, File.join(project_root, "teapot.rb"))
2724

2825
selection = top.context.select
2926

0 commit comments

Comments
 (0)