Fix test
This commit is contained in:
parent
941e0f06ec
commit
5b1954f100
8 changed files with 21 additions and 21 deletions
|
@ -22,7 +22,7 @@ RSpec.describe Api::V1::Circles::StatusesController do
|
|||
get :show, params: { circle_id: circle.id, limit: 5 }
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
json = body_as_json
|
||||
json = response.parsed_body
|
||||
expect(json.map { |item| item[:id].to_i }).to eq [status.id]
|
||||
end
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ RSpec.describe Api::V1::ListsController do
|
|||
get :index
|
||||
expect(response).to have_http_status(200)
|
||||
|
||||
list_ids = body_as_json.pluck(:id)
|
||||
list_ids = response.parsed_body.pluck(:id)
|
||||
expect(list_ids.size).to eq 1
|
||||
expect(list_ids).to include list_id
|
||||
end
|
||||
|
|
|
@ -168,7 +168,7 @@ RSpec.describe '/api/v1/accounts' do
|
|||
it 'returns JSON with following=false and requested=true' do
|
||||
subject
|
||||
|
||||
json = body_as_json
|
||||
json = response.parsed_body
|
||||
|
||||
expect(json[:following]).to be false
|
||||
expect(json[:requested]).to be true
|
||||
|
|
|
@ -34,7 +34,7 @@ RSpec.describe 'Accounts' do
|
|||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
expect(body_as_json).to match_array(expected_response)
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
end
|
||||
|
||||
context 'with limit param' do
|
||||
|
@ -43,7 +43,7 @@ RSpec.describe 'Accounts' do
|
|||
it 'returns only the requested number of accounts' do
|
||||
subject
|
||||
|
||||
expect(body_as_json.size).to eq(params[:limit])
|
||||
expect(response.parsed_body.size).to eq(params[:limit])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ RSpec.describe 'Domain Blocks' do
|
|||
it 'returns http success and dont include hidden record' do
|
||||
get api_v1_instance_domain_blocks_path
|
||||
|
||||
expect(body_as_json.pluck(:domain)).to_not include('hello.com')
|
||||
expect(response.parsed_body.pluck(:domain)).to_not include('hello.com')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -59,7 +59,7 @@ RSpec.describe 'Domain Blocks' do
|
|||
expect(response)
|
||||
.to have_http_status(200)
|
||||
|
||||
expect(body_as_json)
|
||||
expect(response.parsed_body)
|
||||
.to be_present
|
||||
.and(be_an(Array))
|
||||
.and(have_attributes(size: 1))
|
||||
|
@ -71,7 +71,7 @@ RSpec.describe 'Domain Blocks' do
|
|||
it 'returns http success and dont include hidden record' do
|
||||
get api_v1_instance_domain_blocks_path, headers: headers
|
||||
|
||||
expect(body_as_json.pluck(:domain)).to_not include('hello.com')
|
||||
expect(response.parsed_body.pluck(:domain)).to_not include('hello.com')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ RSpec.describe 'EmojiReactions' do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, emoji_reactions_count: 1)
|
||||
)
|
||||
end
|
||||
|
@ -133,7 +133,7 @@ RSpec.describe 'EmojiReactions' do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, emoji_reactions_count: 0)
|
||||
)
|
||||
end
|
||||
|
@ -155,7 +155,7 @@ RSpec.describe 'EmojiReactions' do
|
|||
it 'returns json with updated attributes' do
|
||||
subject
|
||||
|
||||
expect(body_as_json).to match(
|
||||
expect(response.parsed_body).to match(
|
||||
a_hash_including(id: status.id.to_s, emoji_reactions_count: 0)
|
||||
)
|
||||
end
|
||||
|
|
|
@ -126,15 +126,15 @@ RSpec.describe '/api/v1/statuses' do
|
|||
|
||||
it 'returns unique ancestors' do
|
||||
get "/api/v1/statuses/#{thread.id}/context"
|
||||
status_ids = body_as_json[:ancestors].map { |ref| ref[:id].to_i }
|
||||
status_ids = response.parsed_body[:ancestors].map { |ref| ref[:id].to_i }
|
||||
|
||||
expect(status_ids).to eq [status.id]
|
||||
end
|
||||
|
||||
it 'returns unique references' do
|
||||
get "/api/v1/statuses/#{thread.id}/context", params: { with_reference: true }
|
||||
ancestor_status_ids = body_as_json[:ancestors].map { |ref| ref[:id].to_i }
|
||||
reference_status_ids = body_as_json[:references].map { |ref| ref[:id].to_i }
|
||||
ancestor_status_ids = response.parsed_body[:ancestors].map { |ref| ref[:id].to_i }
|
||||
reference_status_ids = response.parsed_body[:references].map { |ref| ref[:id].to_i }
|
||||
|
||||
expect(ancestor_status_ids).to eq [status.id]
|
||||
expect(reference_status_ids).to eq []
|
||||
|
@ -164,14 +164,14 @@ RSpec.describe '/api/v1/statuses' do
|
|||
|
||||
it 'returns empty references' do
|
||||
get "/api/v1/statuses/#{status.id}/context", headers: headers
|
||||
status_ids = body_as_json[:references].map { |ref| ref[:id].to_i }
|
||||
status_ids = response.parsed_body[:references].map { |ref| ref[:id].to_i }
|
||||
|
||||
expect(status_ids).to eq []
|
||||
end
|
||||
|
||||
it 'contains referred status' do
|
||||
get "/api/v1/statuses/#{status.id}/context", headers: headers
|
||||
status_ids = body_as_json[:ancestors].map { |ref| ref[:id].to_i }
|
||||
status_ids = response.parsed_body[:ancestors].map { |ref| ref[:id].to_i }
|
||||
|
||||
expect(status_ids).to include referred.id
|
||||
expect(status_ids).to include referred_private_following.id
|
||||
|
@ -179,14 +179,14 @@ RSpec.describe '/api/v1/statuses' do
|
|||
|
||||
it 'does not contain private status' do
|
||||
get "/api/v1/statuses/#{status.id}/context", headers: headers
|
||||
status_ids = body_as_json[:ancestors].map { |ref| ref[:id].to_i }
|
||||
status_ids = response.parsed_body[:ancestors].map { |ref| ref[:id].to_i }
|
||||
|
||||
expect(status_ids).to_not include referred_private.id
|
||||
end
|
||||
|
||||
it 'does not contain private status when not autienticated' do
|
||||
get "/api/v1/statuses/#{status.id}/context"
|
||||
status_ids = body_as_json[:ancestors].map { |ref| ref[:id].to_i }
|
||||
status_ids = response.parsed_body[:ancestors].map { |ref| ref[:id].to_i }
|
||||
|
||||
expect(status_ids).to_not include referred_private.id
|
||||
end
|
||||
|
@ -199,14 +199,14 @@ RSpec.describe '/api/v1/statuses' do
|
|||
|
||||
it 'returns empty ancestors' do
|
||||
get "/api/v1/statuses/#{status.id}/context", params: { with_reference: true }, headers: headers
|
||||
status_ids = body_as_json[:ancestors].map { |ref| ref[:id].to_i }
|
||||
status_ids = response.parsed_body[:ancestors].map { |ref| ref[:id].to_i }
|
||||
|
||||
expect(status_ids).to eq []
|
||||
end
|
||||
|
||||
it 'contains referred status' do
|
||||
get "/api/v1/statuses/#{status.id}/context", params: { with_reference: true }, headers: headers
|
||||
status_ids = body_as_json[:references].map { |ref| ref[:id].to_i }
|
||||
status_ids = response.parsed_body[:references].map { |ref| ref[:id].to_i }
|
||||
|
||||
expect(status_ids).to include referred.id
|
||||
end
|
||||
|
|
|
@ -156,7 +156,7 @@ RSpec.describe 'Public' do
|
|||
context 'when user is setting filters' do
|
||||
subject do
|
||||
get '/api/v1/timelines/public', headers: headers, params: params
|
||||
body_as_json.filter { |status| status[:filtered].empty? || status[:filtered][0][:filter][:id] != filter.id.to_s }.map { |status| status[:id].to_i }
|
||||
response.parsed_body.filter { |status| status[:filtered].empty? || status[:filtered][0][:filter][:id] != filter.id.to_s }.map { |status| status[:id].to_i }
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue