mastodon/spec/controllers/tags_controller_spec.rb

33 lines
1.0 KiB
Ruby
Raw Normal View History

2016-11-05 15:20:05 +01:00
require 'rails_helper'
RSpec.describe TagsController, type: :controller do
render_views
2016-11-05 15:20:05 +01:00
describe 'GET #show' do
2017-05-25 16:07:38 +02:00
let!(:tag) { Fabricate(:tag, name: 'test') }
2017-10-07 20:00:35 +02: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 16:07:38 +02:00
context 'when tag exists' do
it 'returns http success' do
get :show, params: { id: 'test', max_id: late.id }
expect(response).to have_http_status(:success)
end
2017-10-07 20:00:35 +02:00
it 'renders application layout' do
2017-05-25 16:07:38 +02:00
get :show, params: { id: 'test', max_id: late.id }
2017-10-07 20:00:35 +02:00
expect(response).to render_template layout: 'application'
2017-05-25 16:07:38 +02:00
end
2016-11-05 15:20:05 +01:00
end
2017-05-25 16:07:38 +02:00
context 'when tag does not exist' do
it 'returns http missing for non-existent tag' do
get :show, params: { id: 'none' }
2017-05-25 16:07:38 +02:00
expect(response).to have_http_status(:missing)
end
end
2016-11-05 15:20:05 +01:00
end
end