Adds traits to enterprise_factory and spec

This commit is contained in:
filipefurtad0
2022-06-13 16:40:55 +01:00
parent 9c8756bf42
commit 464496befa
2 changed files with 9 additions and 1 deletions

View File

@@ -23,6 +23,14 @@ FactoryBot.define do
end
end
trait :with_logo_image do
logo { Rack::Test::UploadedFile.new('spec/fixtures/files/logo.png', 'image/png') }
end
trait :with_promo_image do
logo { Rack::Test::UploadedFile.new('spec/fixtures/files/promo.png', 'image/png') }
end
factory :supplier_enterprise, parent: :enterprise do
is_primary_producer { true }
sells { "none" }

View File

@@ -225,7 +225,7 @@ describe SubscriptionMailer, type: :mailer do
end
describe "order placement summary" do
let!(:shop) { create(:enterprise) }
let!(:shop) { create(:enterprise, :with_logo_image) }
let!(:summary) { double(:summary, shop_id: shop.id) }
let(:body) { strip_tags(SubscriptionMailer.deliveries.last.body.encoded) }
let(:scope) { "subscription_mailer" }