Commit 6256be68

mo khan <mo@mokhan.ca>
2013-12-01 02:39:29
add missing specs for query class.
1 parent 7c19615
Changed files (1)
spec/services/queries/find_all_creations_query_spec.rb
@@ -0,0 +1,22 @@
+require "spec_helper"
+
+describe FindAllCreationsQuery do
+  let(:sut) { FindAllCreationsQuery.new }
+  let(:results) { sut.fetch({}) }
+
+  let!(:cake_with_a_photo) { create(:creation, photos: [create(:photo)]) }
+  let!(:cake_without_a_photo) { create(:creation, photos: []) }
+  let!(:restricted_cake) { create(:creation, is_restricted: true, photos: [create(:photo)]) }
+
+  it "returns all creations with at least one photo" do
+    results.should include(cake_with_a_photo)
+  end
+
+  it "ignores cakes without a photo" do
+    results.should_not include(cake_without_a_photo)
+  end
+
+  it "ignores restricted cakes" do
+    results.should_not include(restricted_cake)
+  end
+end