# frozen_string_literal: true require 'rails_helper' RSpec.describe 'api/v3/posts', type: :request do before(:each) do DatabaseCleaner.start end after(:each) do DatabaseCleaner.clean end describe 'GET one image' do it 'returns success' do post = create(:post) get "/api/v3/posts/#{post.id}" expect(response).to have_http_status(200) end it 'has the expected fields' do post = create(:post) get "/api/v3/posts/#{post.id}" json = JSON.parse(response.body) expect(json.keys).to match_array ['post'] expect(json['post'].keys).to match_array(%w[media_type animated aspect_ratio comment_count created_at description downvotes duration faves first_seen_at format height hidden_from_users id intensities mime_type name orig_sha512_hash processed representations score sha512_hash size source_url tag_ids tags thumbnails_generated updated_at upvotes view_url width wilson_score locations]) end end # describe 'GET index' do # it 'returns success' do # get '/api/v3/posts' # # expect(response).to have_http_status(200) # end # end end