summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-10-18 19:28:45 -0600
committermo khan <mo@mokhan.ca>2014-10-18 19:28:45 -0600
commitcb7b07bb710f2a7344555062f7ebd70a3cb481e6 (patch)
treed5686b2f059901f47ae7ed478efe7b2bb34504ee /spec
parent6a07f43e2f8b2ff287ee70bccf879219b5b09cd8 (diff)
add search by name and description.
Diffstat (limited to 'spec')
-rw-r--r--spec/factories.rb2
-rw-r--r--spec/services/application/all_cakes_query_spec.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/spec/factories.rb b/spec/factories.rb
index 526592e2..436c3ae4 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -16,7 +16,7 @@ FactoryGirl.define do
factory :cake, class: Creation do
name { Faker::Name.name }
- story 'whats the story morning glory?'
+ story { Faker::HipsterIpsum.words(50).join(' ') }
association :user
association :category
end
diff --git a/spec/services/application/all_cakes_query_spec.rb b/spec/services/application/all_cakes_query_spec.rb
index 4e2dbb6a..b2f25120 100644
--- a/spec/services/application/all_cakes_query_spec.rb
+++ b/spec/services/application/all_cakes_query_spec.rb
@@ -37,5 +37,11 @@ describe AllCakesQuery do
expect(cakes).to include(cake)
expect(cakes).to_not include(cookie)
end
+
+ it 'returns all cakes that match the search query' do
+ cakes = subject.fetch(q: cake.name[0..2])
+ expect(cakes).to include(cake)
+ expect(cakes).to_not include(cookie)
+ end
end
end