From fcd4a6d6bf3e9a8f35a558313c4b0af46c017445 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Tue, 4 Jun 2013 08:29:42 +0100 Subject: [PATCH] Add photo model spec. --- spec/models/photo_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 spec/models/photo_spec.rb diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb new file mode 100644 index 0000000..c829337 --- /dev/null +++ b/spec/models/photo_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe Photo do + it { should have_and_belong_to_many(:categories) } + + let(:photo) { create(:photo) } + + it "logs a view" do + expect { photo.log_view }.to change{photo.views}.by(1) + end +end