debian-mirror-gitlab/spec/lib/gitlab/gon_helper_spec.rb

40 lines
868 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::GonHelper do
let(:helper) do
Class.new do
include Gitlab::GonHelper
end.new
end
describe '#push_frontend_feature_flag' do
it 'pushes a feature flag to the frontend' do
gon = instance_double('gon')
2020-06-23 00:09:42 +05:30
thing = stub_feature_flag_gate('thing')
stub_feature_flags(my_feature_flag: thing)
2018-12-13 13:39:08 +05:30
allow(helper)
.to receive(:gon)
.and_return(gon)
expect(gon)
.to receive(:push)
.with({ features: { 'myFeatureFlag' => true } }, true)
2020-06-23 00:09:42 +05:30
helper.push_frontend_feature_flag(:my_feature_flag, thing)
2018-12-13 13:39:08 +05:30
end
end
2019-02-15 15:39:39 +05:30
describe '#default_avatar_url' do
it 'returns an absolute URL' do
url = helper.default_avatar_url
expect(url).to match(/^http/)
expect(url).to match(/no_avatar.*png$/)
end
end
2018-12-13 13:39:08 +05:30
end