blob: 143f52555ecf505331cb60dabdc2b45e1c70e370 (
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
30
31
32
33
34
35
36
37
38
39
40
41
|
# 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
|