diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2018-08-01 13:47:33 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2018-08-01 15:08:45 +1000 |
commit | 3f421a018e918865a3a36300a4dcefc5d1c8676a (patch) | |
tree | 65c018b25b0c274b4911c0b754b3b5f1c2e3d59e /lib | |
parent | 5663f7a16f210bdcd6f0f884c790670fd8a9549f (diff) | |
download | gitlab-shell-3f421a018e918865a3a36300a4dcefc5d1c8676a.tar.gz |
Update Actor::Username, add specs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/actor/username.rb | 14 | ||||
-rw-r--r-- | lib/gitlab_shell.rb | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/actor/username.rb b/lib/actor/username.rb index e0a07dd..cd9d6e5 100644 --- a/lib/actor/username.rb +++ b/lib/actor/username.rb @@ -1,9 +1,8 @@ require_relative 'base' +require_relative 'key' module Actor - class Username < Base - alias username identifier - + class Username < Key def self.identifier_prefix 'username'.freeze end @@ -13,7 +12,14 @@ module Actor end def self.id_regex - /\Ausername\-\d+\Z/ + /\Ausername\-[a-z0-9-]+\z/ + end + + private + + # Override Base#label + def label + 'user' end end end diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index 7b2b2b1..6b5ea0d 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -33,7 +33,7 @@ class GitlabShell end parsed_command = parse_cmd(origin_cmd) - action = determine_action(parsed_command) # FIXME: watch out + action = determine_action(parsed_command) action.execute(parsed_command.command, parsed_command.args) rescue GitlabNet::ApiUnreachableError $stderr.puts "GitLab: Failed to authorize your Git request: internal API unreachable" |