Add budget image to Budget and image factories and model

This commit is contained in:
karim-semmoud
2023-06-13 11:47:22 +02:00
committed by Javi Martín
parent 443c5e0a53
commit f4973498be
3 changed files with 6 additions and 0 deletions

View File

@@ -8,6 +8,10 @@ FactoryBot.define do
association :imageable, factory: :proposal association :imageable, factory: :proposal
end end
trait :budget_image do
association :imageable, factory: :budget
end
trait :budget_investment_image do trait :budget_investment_image do
association :imageable, factory: :budget_investment association :imageable, factory: :budget_investment
end end

View File

@@ -6,6 +6,7 @@ describe Budget do
it_behaves_like "sluggable", updatable_slug_trait: :drafting it_behaves_like "sluggable", updatable_slug_trait: :drafting
it_behaves_like "reportable" it_behaves_like "reportable"
it_behaves_like "globalizable", :budget it_behaves_like "globalizable", :budget
it_behaves_like "acts as imageable", :budget_image
describe "scopes" do describe "scopes" do
describe ".open" do describe ".open" do

View File

@@ -2,6 +2,7 @@ require "rails_helper"
describe Image do describe Image do
it_behaves_like "image validations", "budget_investment_image" it_behaves_like "image validations", "budget_investment_image"
it_behaves_like "image validations", "budget_image"
it_behaves_like "image validations", "proposal_image" it_behaves_like "image validations", "proposal_image"
it "stores attachments with Active Storage" do it "stores attachments with Active Storage" do