Add missing image model spec. Add shared specs to check image validations at any imageable model
This commit is contained in:
19
spec/models/direct_upload_spec.rb
Normal file
19
spec/models/direct_upload_spec.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe DirectUpload do
|
||||
|
||||
it "should be valid for different kind of combinations when attachment is valid" do
|
||||
expect(build(:direct_upload, :proposal, :documents)).to be_valid
|
||||
expect(build(:direct_upload, :proposal, :image)).to be_valid
|
||||
expect(build(:direct_upload, :budget_investment, :documents)).to be_valid
|
||||
expect(build(:direct_upload, :budget_investment, :image)).to be_valid
|
||||
end
|
||||
|
||||
it "should not be valid for different kind of combinations when invalid atttachment content types" do
|
||||
expect(build(:direct_upload, :proposal, :documents, attachment: File.new("spec/fixtures/files/clippy.png"))).not_to be_valid
|
||||
expect(build(:direct_upload, :proposal, :image, attachment: File.new("spec/fixtures/files/empty.pdf"))).not_to be_valid
|
||||
expect(build(:direct_upload, :budget_investment, :documents, attachment: File.new("spec/fixtures/files/clippy.png"))).not_to be_valid
|
||||
expect(build(:direct_upload, :budget_investment, :image, attachment: File.new("spec/fixtures/files/empty.pdf"))).not_to be_valid
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user