-
Notifications
You must be signed in to change notification settings - Fork 36
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 #47 from basecamp/handle-empty-usernames
Add option to ask for username when the username is not set.
- Loading branch information
Showing
10 changed files
with
84 additions
and
28 deletions.
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
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Console1984 | ||
VERSION = '0.1.22' | ||
VERSION = '0.1.23' | ||
end |
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,29 @@ | ||
require "test_helper" | ||
|
||
class IncinerationTest < ActiveSupport::TestCase | ||
setup do | ||
@supervisor = Console1984::Supervisor.new | ||
end | ||
|
||
test "raises error when allow_empty_username is false and no username is provided" do | ||
original, Console1984.config.ask_for_username_if_empty = Console1984.config.ask_for_username_if_empty, false | ||
Console1984.username_resolver.username = "" | ||
|
||
assert_raises Console1984::Errors::MissingUsername do | ||
@supervisor.current_username | ||
end | ||
ensure | ||
Console1984.config.ask_for_username_if_empty = original | ||
end | ||
|
||
test "asks for username allow_empty_username is true and no username is provided" do | ||
original, Console1984.config.ask_for_username_if_empty = Console1984.config.ask_for_username_if_empty, true | ||
Console1984.username_resolver.username = "" | ||
|
||
type_when_prompted "Jorge M." do | ||
assert_equal "Jorge M.", @supervisor.current_username | ||
end | ||
ensure | ||
Console1984.config.ask_for_username_if_empty = original | ||
end | ||
end |
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