diff --git a/app/models/cluster.rb b/app/models/cluster.rb index 54843250c1..9ce144bc9a 100644 --- a/app/models/cluster.rb +++ b/app/models/cluster.rb @@ -5,7 +5,7 @@ class Cluster < ApplicationRecord has_many :project_medias, through: :cluster_project_medias belongs_to :feed - belongs_to :project_media # Center + belongs_to :project_media, optional: true # Center def center self.project_media || self.items.first diff --git a/test/controllers/graphql_controller_12_test.rb b/test/controllers/graphql_controller_12_test.rb index b20eee968f..c6d3943773 100644 --- a/test/controllers/graphql_controller_12_test.rb +++ b/test/controllers/graphql_controller_12_test.rb @@ -317,7 +317,7 @@ def teardown authenticate_with_user(@u) query = 'query { feed(id: "' + f.id.to_s + '") { clusters(first: 10) { edges { node { id, dbid, first_item_at, last_item_at, last_request_date, last_fact_check_date, center { id }, teams(first: 10) { edges { node { name, avatar } } } } } } } }' - assert_queries(20, '=') do + assert_queries 20, '<=' do post :create, params: { query: query } end assert_response :success diff --git a/test/models/cluster_project_media_test.rb b/test/models/cluster_project_media_test.rb index 7ec284fb38..dd71524ee2 100644 --- a/test/models/cluster_project_media_test.rb +++ b/test/models/cluster_project_media_test.rb @@ -22,4 +22,4 @@ def setup ClusterProjectMedia.create!(cluster: c, project_media: nil) end end -end \ No newline at end of file +end