Commit a141d7d1
Changed files (1)
spec
controllers
api
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