diff options
| author | mo khan <mo@mokhan.ca> | 2014-10-18 19:28:45 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-10-18 19:28:45 -0600 |
| commit | cb7b07bb710f2a7344555062f7ebd70a3cb481e6 (patch) | |
| tree | d5686b2f059901f47ae7ed478efe7b2bb34504ee /spec | |
| parent | 6a07f43e2f8b2ff287ee70bccf879219b5b09cd8 (diff) | |
add search by name and description.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/factories.rb | 2 | ||||
| -rw-r--r-- | spec/services/application/all_cakes_query_spec.rb | 6 |
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 |
