diff options
Diffstat (limited to 'spec/lib/gitlab/git/blame_mode_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git/blame_mode_spec.rb | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/blame_mode_spec.rb b/spec/lib/gitlab/git/blame_mode_spec.rb new file mode 100644 index 00000000000..3496b763f92 --- /dev/null +++ b/spec/lib/gitlab/git/blame_mode_spec.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Git::BlameMode, feature_category: :source_code_management do + subject(:blame_mode) { described_class.new(project, params) } + + let_it_be(:project) { build(:project) } + let(:params) { {} } + + describe '#streaming?' do + subject { blame_mode.streaming? } + + it { is_expected.to be_falsey } + + context 'when streaming param is provided' do + let(:params) { { streaming: true } } + + it { is_expected.to be_truthy } + end + end + + describe '#pagination?' do + subject { blame_mode.pagination? } + + it { is_expected.to be_truthy } + + context 'when `streaming` params is enabled' do + let(:params) { { streaming: true } } + + it { is_expected.to be_falsey } + end + + context 'when `no_pagination` param is provided' do + let(:params) { { no_pagination: true } } + + it { is_expected.to be_falsey } + end + + context 'when `blame_page_pagination` is disabled' do + before do + stub_feature_flags(blame_page_pagination: false) + end + + it { is_expected.to be_falsey } + end + end + + describe '#full?' do + subject { blame_mode.full? } + + it { is_expected.to be_falsey } + + context 'when `blame_page_pagination` is disabled' do + before do + stub_feature_flags(blame_page_pagination: false) + end + + it { is_expected.to be_truthy } + end + end +end |