diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-12 12:16:59 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-11-12 12:16:59 +0200 |
commit | 1dc99b4cbb9a98264fb9cda6f9848020b972b0fa (patch) | |
tree | 53c2fc605a25777e9f9ee0a994bd6f557931476c | |
parent | ae84137108bf1e910e1067606e9a316656bc5fa1 (diff) | |
parent | 98db90c4c9f33d16f496ebb5fe589d6312f136c4 (diff) | |
download | gitlab-ce-1dc99b4cbb9a98264fb9cda6f9848020b972b0fa.tar.gz |
Merge pull request #8251 from cirosantilli/factor-regex-message-spec
Factor regex error messages with spec API tests
-rw-r--r-- | spec/requests/api/projects_spec.rb | 6 | ||||
-rw-r--r-- | spec/requests/api/users_spec.rb | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 067935c82a6..2c4b68c10b6 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -203,14 +203,12 @@ describe API::API, api: true do json_response['message']['name'].should == [ 'can\'t be blank', 'is too short (minimum is 0 characters)', - 'can contain only letters, digits, \'_\', \'-\' and \'.\' and '\ - 'space. It must start with letter, digit or \'_\'.' + Gitlab::Regex.project_regex_message ] json_response['message']['path'].should == [ 'can\'t be blank', 'is too short (minimum is 0 characters)', - 'can contain only letters, digits, \'_\', \'-\' and \'.\'. ' \ - 'Cannot start with \'-\' or end in \'.git\'' + Gitlab::Regex.send(:default_regex_message) ] end diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index a1a26d80a14..113a39b870e 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -140,8 +140,7 @@ describe API::API, api: true do json_response['message']['projects_limit']. should == ['must be greater than or equal to 0'] json_response['message']['username']. - should == ['can contain only letters, digits, '\ - '\'_\', \'-\' and \'.\'. Cannot start with \'-\' or end in \'.git\''] + should == [Gitlab::Regex.send(:default_regex_message)] end it "shouldn't available for non admin users" do @@ -283,8 +282,7 @@ describe API::API, api: true do json_response['message']['projects_limit']. should == ['must be greater than or equal to 0'] json_response['message']['username']. - should == ['can contain only letters, digits, '\ - '\'_\', \'-\' and \'.\'. Cannot start with \'-\' or end in \'.git\''] + should == [Gitlab::Regex.send(:default_regex_message)] end context "with existing user" do |