1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe StreamDiffs, type: :controller, feature_category: :source_code_management do
subject(:controller) do
Class.new(ApplicationController) do
include StreamDiffs
def call_resource
resource
end
def call_options
streaming_diff_options
end
def diff_options
{
ignore_whitespace_change: false,
expanded: false,
use_extra_viewer_as_main: true,
offset_index: 0
}
end
end
end
describe '#resource' do
it 'raises NotImplementedError' do
expect { controller.new.call_resource }.to raise_error(NotImplementedError)
end
end
describe '#options' do
it 'returns hash of diff_options' do
expect(controller.new.call_options).to eq({
ignore_whitespace_change: false,
expanded: false,
use_extra_viewer_as_main: true,
offset_index: 0
})
end
end
describe '#request' do
it 'forces format as HTML' do
expect(controller.new.request.format.to_s).to eq('text/html')
end
end
end
|