logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

tags_controller_spec.rb (1049B)


  1. require 'rails_helper'
  2. RSpec.describe TagsController, type: :controller do
  3. render_views
  4. describe 'GET #show' do
  5. let!(:tag) { Fabricate(:tag, name: 'test') }
  6. let!(:local) { Fabricate(:status, tags: [tag], text: 'local #test') }
  7. let!(:remote) { Fabricate(:status, tags: [tag], text: 'remote #test', account: Fabricate(:account, domain: 'remote')) }
  8. let!(:late) { Fabricate(:status, tags: [tag], text: 'late #test') }
  9. context 'when tag exists' do
  10. it 'returns http success' do
  11. get :show, params: { id: 'test', max_id: late.id }
  12. expect(response).to have_http_status(:success)
  13. end
  14. it 'renders application layout' do
  15. get :show, params: { id: 'test', max_id: late.id }
  16. expect(response).to render_template layout: 'application'
  17. end
  18. end
  19. context 'when tag does not exist' do
  20. it 'returns http missing for non-existent tag' do
  21. get :show, params: { id: 'none' }
  22. expect(response).to have_http_status(:missing)
  23. end
  24. end
  25. end
  26. end