Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Add test for emails without a prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aa Bb committed Mar 14, 2012
1 parent 0646f23 commit 15d6602
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/git-pair
Expand Up @@ -87,7 +87,8 @@ if authors.any?
else
authors = names[0..-2].join(", ") + " & " + names.last
end
email = if email_prefix = config['email']['prefix']

email = if config['email'].is_a?(Hash)
"#{([config['email']['prefix']] + emails).compact.join('+')}@#{config['email']['domain']}"
else
config['email']
Expand Down
6 changes: 6 additions & 0 deletions spec/cli_spec.rb
Expand Up @@ -167,6 +167,12 @@ def expect_config(result, name, initials, email, options={})
expect_config result, "Aa Bb", "ab", "foo@bar.com"
end

it "uses no email prefix when only host is given" do
write ".pairs", File.read(".pairs").sub(/email:.*/m, "email:\n domain: foo.com")
result = run "git pair ab"
expect_config result, "Aa Bb", "ab", "aa@foo.com"
end

it "fails with unknown initials" do
result = run "git pair xx", :fail => true
result.should include("Couldn't find author name for initials: xx")
Expand Down

0 comments on commit 15d6602

Please sign in to comment.