diff --git a/spec/factories/photos.rb b/spec/factories/photos.rb index 2ef9f04..3baa1a4 100644 --- a/spec/factories/photos.rb +++ b/spec/factories/photos.rb @@ -4,5 +4,6 @@ FactoryGirl.define do factory :photo do title "A Photo" description "A lovely photo of a tree" + image Rails.root.join('spec/fixtures/photo.jpg') end end diff --git a/spec/fixtures/photo.jpg b/spec/fixtures/photo.jpg new file mode 100644 index 0000000..ecca8c8 Binary files /dev/null and b/spec/fixtures/photo.jpg differ diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index c829337..21e51aa 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' describe Photo do it { should have_and_belong_to_many(:categories) } + it { should validate_presence_of(:image) } + let(:photo) { create(:photo) } it "logs a view" do