2016-11-05 14:20:05 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe TagsController, type: :controller do
|
2016-11-18 22:08:52 +00:00
|
|
|
render_views
|
2016-11-05 14:20:05 +00:00
|
|
|
|
|
|
|
describe 'GET #show' do
|
2017-05-25 14:07:38 +00:00
|
|
|
let!(:tag) { Fabricate(:tag, name: 'test') }
|
2017-10-07 18:00:35 +00: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 14:07:38 +00:00
|
|
|
|
|
|
|
context 'when tag exists' do
|
|
|
|
it 'returns http success' do
|
|
|
|
get :show, params: { id: 'test', max_id: late.id }
|
2018-04-21 19:35:07 +00:00
|
|
|
expect(response).to have_http_status(200)
|
2017-05-25 14:07:38 +00:00
|
|
|
end
|
|
|
|
|
2017-10-07 18:00:35 +00:00
|
|
|
it 'renders application layout' do
|
2017-05-25 14:07:38 +00:00
|
|
|
get :show, params: { id: 'test', max_id: late.id }
|
2019-01-16 18:47:46 +00:00
|
|
|
expect(response).to render_template layout: 'public'
|
2017-05-25 14:07:38 +00:00
|
|
|
end
|
2016-11-05 14:20:05 +00:00
|
|
|
end
|
2017-04-28 13:11:21 +00:00
|
|
|
|
2017-05-25 14:07:38 +00: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 13:11:21 +00:00
|
|
|
|
2018-04-21 19:35:07 +00:00
|
|
|
expect(response).to have_http_status(404)
|
2017-05-25 14:07:38 +00:00
|
|
|
end
|
2017-04-28 13:11:21 +00:00
|
|
|
end
|
2016-11-05 14:20:05 +00:00
|
|
|
end
|
|
|
|
end
|