Skip to content

Commit

Permalink
spec/imastodon/controllers/api/v1/timelines/tag_controller_spec.rb をp…
Browse files Browse the repository at this point in the history
…assするように修正

tokenにreadスコープが足りていなかった
  • Loading branch information
takayamaki committed Jan 3, 2025
1 parent db2a536 commit 4a72dbb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions spec/imastodon/controllers/api/v1/timelines/tag_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
end

context 'with a user context' do
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: [:read]) }

describe 'GET #show' do
before do
Expand All @@ -31,14 +31,20 @@
end

context 'without a user context' do
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: nil) }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: nil, scopes: [:read]) }

before do
PostStatusService.new.call(user.account, text: 'It is a public #test')
PostStatusService.new.call(user.account, text: 'It is a unlisted #test', visibility: 'unlisted')
end

describe 'GET #show' do
it 'returns http success' do
get :show, params: { id: 'test' }
expect(response).to have_http_status(200)
expect(response.headers['Link']).to be_nil
expect(JSON.parse(response.body).length).to eq(0)
expect(response.headers['Link'].links.size).to eq(2)
expect(JSON.parse(response.body).length).to eq(1)
expect(JSON.parse(response.body).first["content"]).to include('It is a public')
end
end
end
Expand Down

0 comments on commit 4a72dbb

Please sign in to comment.