diff options
| author | mo khan <mo@mokhan.ca> | 2013-11-30 19:39:29 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2013-11-30 19:39:29 -0700 |
| commit | 6256be68c46ea0d244c182e477111fae8901822f (patch) | |
| tree | ebf2ef8ff93f38c3be7341ac385fb67477b5a33f /spec/services | |
| parent | 7c19615caeb3290bcc6edeebfacef4f7b1d6ae83 (diff) | |
add missing specs for query class.
Diffstat (limited to 'spec/services')
| -rw-r--r-- | spec/services/queries/find_all_creations_query_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/services/queries/find_all_creations_query_spec.rb b/spec/services/queries/find_all_creations_query_spec.rb new file mode 100644 index 00000000..be36c437 --- /dev/null +++ b/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 |
