diff options
author | Alexander Randa <randa.alex@gmail.com> | 2017-07-20 15:12:06 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-20 15:12:06 +0000 |
commit | e0ab5618a0998175df9f90c95ebd35d7afa01db7 (patch) | |
tree | 91cfff5c3c9f6a118d69df5e2816b7461ce2ccc5 /spec/lib/gitlab/data_builder | |
parent | 020b6a0be06614815d96854084f3dcafeefcf0b7 (diff) | |
download | gitlab-ce-e0ab5618a0998175df9f90c95ebd35d7afa01db7.tar.gz |
Wrong data type when testing webhooks
Diffstat (limited to 'spec/lib/gitlab/data_builder')
-rw-r--r-- | spec/lib/gitlab/data_builder/wiki_page_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/gitlab/data_builder/wiki_page_spec.rb b/spec/lib/gitlab/data_builder/wiki_page_spec.rb new file mode 100644 index 00000000000..a776d888c47 --- /dev/null +++ b/spec/lib/gitlab/data_builder/wiki_page_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe Gitlab::DataBuilder::WikiPage do + let(:project) { create(:project, :repository) } + let(:wiki_page) { create(:wiki_page, wiki: project.wiki) } + let(:user) { create(:user) } + + describe '.build' do + let(:data) { described_class.build(wiki_page, user, 'create') } + + it { expect(data).to be_a(Hash) } + it { expect(data[:object_kind]).to eq('wiki_page') } + it { expect(data[:user]).to eq(user.hook_attrs) } + it { expect(data[:project]).to eq(project.hook_attrs) } + it { expect(data[:wiki]).to eq(project.wiki.hook_attrs) } + + it { expect(data[:object_attributes]).to include(wiki_page.hook_attrs) } + it { expect(data[:object_attributes]).to include(url: Gitlab::UrlBuilder.build(wiki_page)) } + it { expect(data[:object_attributes]).to include(action: 'create') } + end +end |