mirror of
https://github.com/tmuxinator/tmuxinator.git
synced 2026-03-11 18:24:23 -05:00
Use Correct Project Config File Path When Generating Config File
* 440-fix-config-file-path-in-project-config - use full project config file path when generating project config file * MISC - refactor "should always generate a project file" spec -- use Dir.mktmpdir * 440-fix-config-file-path-in-project-config - update CHANGELOG.md Closes #440.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
## Unreleased
|
||||
- use correct paths in generated config file comment (#440)
|
||||
- fix "wrong namespace" RuboCop warnings (#620)
|
||||
|
||||
## 0.11.2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# ~/.tmuxinator/<%= name %>.yml
|
||||
# <%= path %>
|
||||
|
||||
name: <%= name %>
|
||||
root: ~/
|
||||
|
||||
@@ -638,21 +638,26 @@ describe Tmuxinator::Cli do
|
||||
end
|
||||
|
||||
describe "#generate_project_file" do
|
||||
let(:name) { "foobar" }
|
||||
let(:path) { Tmuxinator::Config.default_project(name) }
|
||||
|
||||
before do
|
||||
expect(File).not_to exist(path), "expected file at #{path} not to exist"
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
FileUtils.remove_file(path) if File.exist?(path)
|
||||
end
|
||||
let(:name) { "foobar-#{Time.now.to_i}" }
|
||||
|
||||
it "should always generate a project file" do
|
||||
new_path = Tmuxinator::Cli.new.generate_project_file(name, path)
|
||||
expect(new_path).to eq path
|
||||
expect(File).to exist new_path
|
||||
Dir.mktmpdir do |dir|
|
||||
path = "#{dir}/#{name}.yml"
|
||||
expect(File).not_to exist(path), "expected file at #{path} not to exist"
|
||||
new_path = Tmuxinator::Cli.new.generate_project_file(name, path)
|
||||
expect(new_path).to eq path
|
||||
expect(File).to exist new_path
|
||||
end
|
||||
end
|
||||
|
||||
it "should generate a project file using the correct project file path" do
|
||||
file = StringIO.new
|
||||
allow(File).to receive(:open) { |&block| block.yield file }
|
||||
Dir.mktmpdir do |dir|
|
||||
path = "#{dir}/#{name}.yml"
|
||||
_ = Tmuxinator::Cli.new.generate_project_file(name, path)
|
||||
expect(file.string).to match %r{\A# #{path}$}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user