Convert "static page" controller specs to system specs (#31599)
This commit is contained in:
		@@ -1,17 +0,0 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe AboutController do
 | 
			
		||||
  render_views
 | 
			
		||||
 | 
			
		||||
  describe 'GET #show' do
 | 
			
		||||
    before do
 | 
			
		||||
      get :show
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'returns http success' do
 | 
			
		||||
      expect(response).to have_http_status(200)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
@@ -1,30 +0,0 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe HomeController do
 | 
			
		||||
  render_views
 | 
			
		||||
 | 
			
		||||
  describe 'GET #index' do
 | 
			
		||||
    subject { get :index }
 | 
			
		||||
 | 
			
		||||
    context 'when not signed in' do
 | 
			
		||||
      it 'returns http success' do
 | 
			
		||||
        request.path = '/'
 | 
			
		||||
        expect(subject).to have_http_status(:success)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'when signed in' do
 | 
			
		||||
      let(:user) { Fabricate(:user) }
 | 
			
		||||
 | 
			
		||||
      before do
 | 
			
		||||
        sign_in(user)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'returns http success' do
 | 
			
		||||
        expect(subject).to have_http_status(:success)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
describe PrivacyController do
 | 
			
		||||
  render_views
 | 
			
		||||
 | 
			
		||||
  describe 'GET #show' do
 | 
			
		||||
    it 'returns http success' do
 | 
			
		||||
      get :show
 | 
			
		||||
      expect(response).to have_http_status(200)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										12
									
								
								spec/system/about_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								spec/system/about_spec.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
describe 'About page' do
 | 
			
		||||
  it 'visits the about page and renders the web app' do
 | 
			
		||||
    visit about_path
 | 
			
		||||
 | 
			
		||||
    expect(page)
 | 
			
		||||
      .to have_css('noscript', text: /Mastodon/)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										25
									
								
								spec/system/home_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								spec/system/home_spec.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
describe 'Home page' do
 | 
			
		||||
  context 'when signed in' do
 | 
			
		||||
    before { sign_in Fabricate(:user) }
 | 
			
		||||
 | 
			
		||||
    it 'visits the homepage and renders the web app' do
 | 
			
		||||
      visit root_path
 | 
			
		||||
 | 
			
		||||
      expect(page)
 | 
			
		||||
        .to have_css('noscript', text: /Mastodon/)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'when not signed in' do
 | 
			
		||||
    it 'visits the homepage and renders the web app' do
 | 
			
		||||
      visit root_path
 | 
			
		||||
 | 
			
		||||
      expect(page)
 | 
			
		||||
        .to have_css('noscript', text: /Mastodon/)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										12
									
								
								spec/system/privacy_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								spec/system/privacy_spec.rb
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
describe 'Privacy policy page' do
 | 
			
		||||
  it 'visits the privacy policy page and renders the web app' do
 | 
			
		||||
    visit privacy_policy_path
 | 
			
		||||
 | 
			
		||||
    expect(page)
 | 
			
		||||
      .to have_css('noscript', text: /Mastodon/)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user