gitlab-org--gitlab-foss/spec/serializers/suggestion_entity_spec.rb
Oswaldo Ferreira 03e0604d5d Prepare suggestion implementation for multi-line
Adds the groundwork needed in order to persist multi-line suggestions,
while providing the parsing strategy which will be reused for the
**Preview** as well.
2019-03-27 12:26:53 -03:00

23 lines
630 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
describe SuggestionEntity do
include RepoHelpers
let(:user) { create(:user) }
let(:request) { double('request', current_user: user) }
let(:suggestion) { create(:suggestion) }
let(:entity) { described_class.new(suggestion, request: request) }
subject { entity.as_json }
it 'exposes correct attributes' do
expect(subject).to include(:id, :from_line, :to_line, :appliable,
:applied, :from_content, :to_content)
end
it 'exposes current user abilities' do
expect(subject[:current_user]).to include(:can_apply)
end
end