2016-11-05 23:20:05 +09:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe TagsController, type: :controller do
|
2016-11-19 07:08:52 +09:00
|
|
|
render_views
|
2016-11-05 23:20:05 +09:00
|
|
|
|
|
|
|
describe 'GET #show' do
|
2017-05-25 23:07:38 +09:00
|
|
|
let!(:tag) { Fabricate(:tag, name: 'test') }
|
2017-10-08 03:00:35 +09:00
|
|
|
let!(:local) { Fabricate(:status, tags: [tag], text: 'local #test') }
|
|
|
|
let!(:remote) { Fabricate(:status, tags: [tag], text: 'remote #test', account: Fabricate(:account, domain: 'remote')) }
|
|
|
|
let!(:late) { Fabricate(:status, tags: [tag], text: 'late #test') }
|
2017-05-25 23:07:38 +09:00
|
|
|
|
|
|
|
context 'when tag exists' do
|
2022-10-05 03:13:46 +09:00
|
|
|
it 'redirects to web version' do
|
2017-05-25 23:07:38 +09:00
|
|
|
get :show, params: { id: 'test', max_id: late.id }
|
2022-10-05 03:13:46 +09:00
|
|
|
expect(response).to redirect_to('/web/tags/test')
|
2017-05-25 23:07:38 +09:00
|
|
|
end
|
2016-11-05 23:20:05 +09:00
|
|
|
end
|
2017-04-28 22:11:21 +09:00
|
|
|
|
2017-05-25 23:07:38 +09:00
|
|
|
context 'when tag does not exist' do
|
|
|
|
it 'returns http missing for non-existent tag' do
|
|
|
|
get :show, params: { id: 'none' }
|
2017-04-28 22:11:21 +09:00
|
|
|
|
2018-04-22 04:35:07 +09:00
|
|
|
expect(response).to have_http_status(404)
|
2017-05-25 23:07:38 +09:00
|
|
|
end
|
2017-04-28 22:11:21 +09:00
|
|
|
end
|
2016-11-05 23:20:05 +09:00
|
|
|
end
|
|
|
|
end
|