You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

7 years ago
7 years ago
7 years ago
7 years ago
  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(200)
  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: 'public'
  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(404)
  23. end
  24. end
  25. end
  26. end