summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-16 23:10:27 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-16 23:10:27 +0100
commit6f714dfb4a9b823ab75508f252d06e19e286d5f2 (patch)
tree409569ad65f1982451d9eb9a5bb0eae078abf01a /spec
parent2749e7a58285e59381a3e788983678d9cf633b45 (diff)
downloadgitlab-ce-6f714dfb4a9b823ab75508f252d06e19e286d5f2.tar.gz
Improve code design after code review
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/chat_name_token_spec.rb4
-rw-r--r--spec/services/chat_names/authorize_user_service_spec.rb4
-rw-r--r--spec/services/chat_names/find_user_service_spec.rb2
-rw-r--r--spec/support/matchers/be_url.rb5
4 files changed, 8 insertions, 7 deletions
diff --git a/spec/lib/gitlab/chat_name_token_spec.rb b/spec/lib/gitlab/chat_name_token_spec.rb
index 8d7e7a99059..8c1e6efa9db 100644
--- a/spec/lib/gitlab/chat_name_token_spec.rb
+++ b/spec/lib/gitlab/chat_name_token_spec.rb
@@ -12,9 +12,7 @@ describe Gitlab::ChatNameToken, lib: true do
end
context 'when storing data' do
- let(:data) {
- { key: 'value' }
- }
+ let(:data) { { key: 'value' } }
subject { described_class.new(@token) }
diff --git a/spec/services/chat_names/authorize_user_service_spec.rb b/spec/services/chat_names/authorize_user_service_spec.rb
index f8c26e51bfc..2ecee58e92d 100644
--- a/spec/services/chat_names/authorize_user_service_spec.rb
+++ b/spec/services/chat_names/authorize_user_service_spec.rb
@@ -10,9 +10,7 @@ describe ChatNames::AuthorizeUserService, services: true do
let(:params) { { team_id: 'T0001', team_domain: 'myteam', user_id: 'U0001', user_name: 'user' } }
it 'requests a new token' do
- is_expected.to include('http')
- is_expected.to include('://')
- is_expected.to include('token=')
+ is_expected.to be_url
end
end
diff --git a/spec/services/chat_names/find_user_service_spec.rb b/spec/services/chat_names/find_user_service_spec.rb
index cf5844069f9..5b885b2c657 100644
--- a/spec/services/chat_names/find_user_service_spec.rb
+++ b/spec/services/chat_names/find_user_service_spec.rb
@@ -20,7 +20,7 @@ describe ChatNames::FindUserService, services: true do
it 'updates when last time chat name was used' do
subject
- expect(chat_name.reload.used_at).to be_like_time(Time.now)
+ expect(chat_name.reload.last_used_at).to be_like_time(Time.now)
end
end
diff --git a/spec/support/matchers/be_url.rb b/spec/support/matchers/be_url.rb
new file mode 100644
index 00000000000..f8096af1b22
--- /dev/null
+++ b/spec/support/matchers/be_url.rb
@@ -0,0 +1,5 @@
+RSpec::Matchers.define :be_url do |_|
+ match do |actual|
+ URI.parse(actual) rescue false
+ end
+end