summaryrefslogtreecommitdiff
path: root/spec/helpers/version_check_helper_spec.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-12-14 11:47:49 -0600
committerRobert Speicher <rspeicher@gmail.com>2018-12-14 13:56:03 -0600
commit04a3e48c2a0e31e31f8ba0e9036597428ee3a373 (patch)
tree641d1554ce6199fe3059ea3f4200e39cec9a95e9 /spec/helpers/version_check_helper_spec.rb
parenteafc8e2f481751b973260287c844b70bd408dcb2 (diff)
downloadgitlab-ce-04a3e48c2a0e31e31f8ba0e9036597428ee3a373.tar.gz
Use class methods for VersionCheck
All of these methods are stateless, there was no point to have them as instance methods. Mostly this allows us to remove an `allow_any_instance_of` usage.
Diffstat (limited to 'spec/helpers/version_check_helper_spec.rb')
-rw-r--r--spec/helpers/version_check_helper_spec.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/helpers/version_check_helper_spec.rb b/spec/helpers/version_check_helper_spec.rb
index 9d4e34abef5..bfec7ad4bba 100644
--- a/spec/helpers/version_check_helper_spec.rb
+++ b/spec/helpers/version_check_helper_spec.rb
@@ -13,21 +13,21 @@ describe VersionCheckHelper do
before do
allow(Rails.env).to receive(:production?) { true }
allow(Gitlab::CurrentSettings.current_application_settings).to receive(:version_check_enabled) { true }
- allow_any_instance_of(VersionCheck).to receive(:url) { 'https://version.host.com/check.svg?gitlab_info=xxx' }
-
- @image_tag = helper.version_status_badge
+ allow(VersionCheck).to receive(:url) { 'https://version.host.com/check.svg?gitlab_info=xxx' }
end
it 'should return an image tag' do
- expect(@image_tag).to match(/^<img/)
+ expect(helper.version_status_badge).to start_with('<img')
end
it 'should have a js prefixed css class' do
- expect(@image_tag).to match(/class="js-version-status-badge lazy"/)
+ expect(helper.version_status_badge)
+ .to match(/class="js-version-status-badge lazy"/)
end
it 'should have a VersionCheck url as the src' do
- expect(@image_tag).to match(%r{src="https://version\.host\.com/check\.svg\?gitlab_info=xxx"})
+ expect(helper.version_status_badge)
+ .to include(%{src="https://version.host.com/check.svg?gitlab_info=xxx"})
end
end
end