diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-05-18 19:38:52 +0200 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-05-29 15:03:00 -0400 |
commit | dbba60029c84fa091350d3a7d8b2e73cfec25f7e (patch) | |
tree | 5024609041e64fe4e27899ea3f40214c4aba0b04 /spec/lib | |
parent | cc2efcf1a681223d5c74eef6fca73cde71dce7c2 (diff) | |
download | gitlab-ce-dbba60029c84fa091350d3a7d8b2e73cfec25f7e.tar.gz |
Improve note factory
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/note_data_builder_spec.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/lib/gitlab/note_data_builder_spec.rb b/spec/lib/gitlab/note_data_builder_spec.rb index 82823e7f790..e848d88182f 100644 --- a/spec/lib/gitlab/note_data_builder_spec.rb +++ b/spec/lib/gitlab/note_data_builder_spec.rb @@ -44,13 +44,13 @@ describe 'Gitlab::NoteDataBuilder', lib: true do end let(:note) do - create(:note_on_issue, noteable_id: issue.id, project: project) + create(:note_on_issue, noteable: issue, project: project) end it 'returns the note and issue-specific data' do expect(data).to have_key(:issue) expect(data[:issue].except('updated_at')) - .to eq(issue.hook_attrs.except('updated_at')) + .to eq(issue.reload.hook_attrs.except('updated_at')) expect(data[:issue]['updated_at']) .to be > issue.hook_attrs['updated_at'] end @@ -67,14 +67,14 @@ describe 'Gitlab::NoteDataBuilder', lib: true do end let(:note) do - create(:note_on_merge_request, noteable_id: merge_request.id, + create(:note_on_merge_request, noteable: merge_request, project: project) end it 'returns the note and merge request data' do expect(data).to have_key(:merge_request) expect(data[:merge_request].except('updated_at')) - .to eq(merge_request.hook_attrs.except('updated_at')) + .to eq(merge_request.reload.hook_attrs.except('updated_at')) expect(data[:merge_request]['updated_at']) .to be > merge_request.hook_attrs['updated_at'] end @@ -90,14 +90,14 @@ describe 'Gitlab::NoteDataBuilder', lib: true do end let(:note) do - create(:note_on_merge_request_diff, noteable_id: merge_request.id, + create(:note_on_merge_request_diff, noteable: merge_request, project: project) end it 'returns the note and merge request diff data' do expect(data).to have_key(:merge_request) expect(data[:merge_request].except('updated_at')) - .to eq(merge_request.hook_attrs.except('updated_at')) + .to eq(merge_request.reload.hook_attrs.except('updated_at')) expect(data[:merge_request]['updated_at']) .to be > merge_request.hook_attrs['updated_at'] end @@ -113,14 +113,14 @@ describe 'Gitlab::NoteDataBuilder', lib: true do end let!(:note) do - create(:note_on_project_snippet, noteable_id: snippet.id, + create(:note_on_project_snippet, noteable: snippet, project: project) end it 'returns the note and project snippet data' do expect(data).to have_key(:snippet) expect(data[:snippet].except('updated_at')) - .to eq(snippet.hook_attrs.except('updated_at')) + .to eq(snippet.reload.hook_attrs.except('updated_at')) expect(data[:snippet]['updated_at']) .to be > snippet.hook_attrs['updated_at'] end |