Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

fix null values in journal specs

ulferts5fefc4cce097
diff --git a/spec/factories/journal/message_journal_factory.rb b/spec/factories/journal/message_journal_factory.rb
index 929ae79c73e..cc0062c4b69 100644
--- a/spec/factories/journal/message_journal_factory.rb
+++ b/spec/factories/journal/message_journal_factory.rb
@@ -28,5 +28,6 @@
FactoryBot.define do
factory :journal_message_journal, class: 'Journal::MessageJournal' do
+ subject { 'abc' }
end
end
diff --git a/spec/factories/journal/news_journal_facctory.rb b/spec/factories/journal/news_journal_factory.rb
similarity index 96%
rename from spec/factories/journal/news_journal_facctory.rb
rename to spec/factories/journal/news_journal_factory.rb
index 51eb36a66e4..952ee253a9a 100644
--- a/spec/factories/journal/news_journal_facctory.rb
+++ b/spec/factories/journal/news_journal_factory.rb
@@ -28,5 +28,7 @@
FactoryBot.define do
factory :journal_news_journal, class: 'Journal::NewsJournal' do
+ title { 'abc' }
+ comments_count { 4 }
end
end
diff --git a/spec/factories/journal/work_package_journal_factory.rb b/spec/factories/journal/work_package_journal_factory.rb
index 01f37e7f135..4f58bf5f444 100644
--- a/spec/factories/journal/work_package_journal_factory.rb
+++ b/spec/factories/journal/work_package_journal_factory.rb
@@ -32,10 +32,12 @@ FactoryBot.define do
# The following properties are not actually valid.
# They were added when the default value (also 0) was removed and too many
# tests relied on this behaviour for it to be fixed right away.
+ subject { 'abc' }
type_id { 0 }
project_id { 0 }
status_id { 0 }
priority_id { 0 }
author_id { 0 }
+ done_ratio { 0 }
end
end
diff --git a/spec/services/principals/replace_references_service_call_integration_spec.rb b/spec/services/principals/replace_references_service_call_integration_spec.rb
index 22d1ad78725..3f214ac1914 100644
--- a/spec/services/principals/replace_references_service_call_integration_spec.rb
+++ b/spec/services/principals/replace_references_service_call_integration_spec.rb
@@ -150,7 +150,13 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
:journal_attachment_journal,
:author_id do
let(:attributes) do
- {}
+ {
+ filename: "'abc.txt'",
+ disk_filename: "'abc.txt'",
+ filesize: 123,
+ digest: "'qwerty'",
+ downloads: 5
+ }
end
end
end
@@ -193,8 +199,10 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
String do
let(:user_cf) { create(:user_wp_custom_field) }
let(:attributes) do
- { journal_id: 1,
- custom_field_id: user_cf.id }
+ {
+ journal_id: 1,
+ custom_field_id: user_cf.id
+ }
end
end
end
@@ -226,7 +234,10 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
:message,
:author_id do
let(:attributes) do
- { forum_id: 1 }
+ {
+ forum_id: 1,
+ subject: "'abc'"
+ }
end
end
@@ -234,7 +245,10 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
:journal_message_journal,
:author_id do
let(:attributes) do
- { forum_id: 1 }
+ {
+ forum_id: 1,
+ subject: "'abc'"
+ }
end
end
end
@@ -274,8 +288,10 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
:meeting_participant,
:user_id do
let(:attributes) do
- { created_at: 'NOW()',
- updated_at: 'NOW()' }
+ {
+ created_at: 'NOW()',
+ updated_at: 'NOW()'
+ }
end
end
end
@@ -289,7 +305,10 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
:journal_news_journal,
:author_id do
let(:attributes) do
- {}
+ {
+ title: "'abc'",
+ comments_count: 5
+ }
end
end
end
@@ -299,8 +318,10 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
:wiki_content,
:author_id do
let(:attributes) do
- { page_id: 1,
- lock_version: 5 }
+ {
+ page_id: 1,
+ lock_version: 5
+ }
end
end
@@ -326,7 +347,9 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
type_id: type.id,
status_id: status.id,
priority_id: priority.id,
- author_id: author.id
+ author_id: author.id,
+ subject: "'abc'",
+ done_ratio: 0
}
end
@@ -347,8 +370,11 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
:assigned_to_id do
let(:attributes) do
{
- # ignore_non_working_days is non nullable. This part is not related to the test.
+ # This part is not related to the test but the columns are non nullable.
ignore_non_working_days: false,
+ subject: "'abc'",
+ done_ratio: 5,
+ # End non relevant.
project_id: project.id,
type_id: type.id,
status_id: status.id,
@@ -363,8 +389,11 @@ describe Principals::ReplaceReferencesService, '#call', type: :model do
:responsible_id do
let(:attributes) do
{
- # ignore_non_working_days is non nullable. This part is not related to the test.
+ # This part is not related to the test but the columns are non nullable.
ignore_non_working_days: false,
+ subject: "'abc'",
+ done_ratio: 5,
+ # End non relevant.
project_id: project.id,
type_id: type.id,
status_id: status.id,