diff options
Diffstat (limited to 'spec/models/wiki_page_spec.rb')
-rw-r--r-- | spec/models/wiki_page_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index 8f2da8ff9a1..a2ca6441f28 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -describe WikiPage do +RSpec.describe WikiPage do let_it_be(:user) { create(:user) } let(:container) { create(:project, :wiki_repo) } let(:wiki) { Wiki.for_container(container, user) } @@ -864,6 +864,24 @@ describe WikiPage do end end + describe '#diffs' do + subject { existing_page } + + it 'returns a diff instance' do + diffs = subject.diffs(foo: 'bar') + + expect(diffs).to be_a(Gitlab::Diff::FileCollection::WikiPage) + expect(diffs.diffable).to be_a(Commit) + expect(diffs.diffable.id).to eq(subject.version.id) + expect(diffs.project).to be(subject.wiki) + expect(diffs.diff_options).to include( + expanded: true, + paths: [subject.path], + foo: 'bar' + ) + end + end + private def get_slugs(page_or_dir) |