-
Notifications
You must be signed in to change notification settings - Fork 909
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3190 from robertcheramy/2222-fix-group-nil
Fix version not found in oxidized-web
- Loading branch information
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require_relative '../spec_helper' | ||
require 'oxidized/output/git' | ||
|
||
describe Oxidized::Git do | ||
describe '#yield_repo_and_path' do | ||
# Note that #yield_repo_and_path is private, so we can not call it directy | ||
# we use @git.send(:yield_repo_and_path, ...) to bypass the protection | ||
before do | ||
# Default value in most tests | ||
Oxidized.config.output.git.single_repo = true | ||
|
||
@mock_node = Minitest::Mock.new | ||
@mock_node.expect(:repo, '/tmp/oxidized.git') | ||
@mock_node.expect(:name, 'switch-42') | ||
|
||
@git = Oxidized::Git.new | ||
end | ||
|
||
it 'accepts group = nil' do | ||
result = @git.send(:yield_repo_and_path, @mock_node, nil) | ||
_(result).must_equal ['/tmp/oxidized.git', 'switch-42'] | ||
end | ||
|
||
it 'ignores an empty group' do | ||
result = @git.send(:yield_repo_and_path, @mock_node, nil) | ||
_(result).must_equal ['/tmp/oxidized.git', 'switch-42'] | ||
end | ||
|
||
it 'takes the group into accout when simple_repo=true' do | ||
# node.name will be needed a second time | ||
@mock_node.expect(:name, 'switch-42') | ||
result = @git.send(:yield_repo_and_path, @mock_node, 'testgroup') | ||
_(result).must_equal ['/tmp/oxidized.git', 'testgroup/switch-42'] | ||
end | ||
|
||
it 'ignores the group when simple_repo=false' do | ||
Oxidized.config.output.git.single_repo = false | ||
result = @git.send(:yield_repo_and_path, @mock_node, 'testgroup') | ||
_(result).must_equal ['/tmp/oxidized.git', 'switch-42'] | ||
end | ||
end | ||
end |