diff options
| author | mo khan <mo@mokhan.ca> | 2014-11-21 17:00:35 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-11-21 17:00:35 -0700 |
| commit | a141d7d1c526c847baddb0f079a64fab59d192a4 (patch) | |
| tree | 4721d1c9696da75c545cba5788df6433a326ac4f /spec/controllers/api | |
| parent | 1cd098e291367cebc52e5a09f3e2e6fb7646de4e (diff) | |
add specs for photos controller.
Diffstat (limited to 'spec/controllers/api')
| -rw-r--r-- | spec/controllers/api/v2/photos_controller_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/api/v2/photos_controller_spec.rb b/spec/controllers/api/v2/photos_controller_spec.rb new file mode 100644 index 00000000..70550ff4 --- /dev/null +++ b/spec/controllers/api/v2/photos_controller_spec.rb @@ -0,0 +1,26 @@ +require 'rails_helper' + +module Api + module V2 + describe PhotosController do + describe "#index" do + let!(:photo) { create(:photo) } + + it 'should load all the photos' do + xhr :get, :index + expect(assigns(:photos)).to match_array([photo]) + end + end + + describe "#show" do + let!(:other_photo) { create(:photo) } + let!(:photo) { create(:photo) } + + it 'loads the specified photo' do + xhr :get, :show, id: photo.id + expect(assigns(:photo)).to eql(photo) + end + end + end + end +end |
