summaryrefslogtreecommitdiff
path: root/spec/controllers/api/v2/photos_controller_spec.rb
blob: df1cef2e93633e542659196a2fd2b3d50064f5a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require "rails_helper"

module Api
  module V2
    describe PhotosController do
      render_views

      describe "#index" do
        let!(:processed_photo) { create(:photo, image_processing: nil) }
        let!(:unprocessed_photo) { create(:photo, image_processing: true) }

        it "loads all processed photos" do
          get :index, xhr: true
          expect(assigns(:photos)).to match_array([processed_photo])
        end
      end

      describe "#show" do
        let!(:other_photo) { create(:photo) }
        let!(:photo) { create(:photo) }

        it "loads the specified photo" do
          get :show, params: { id: photo.id }, xhr: true
          expect(assigns(:photo)).to eql(photo)
        end
      end
    end
  end
end