2024-04-25 16:46:20 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-03-15 18:27:31 -04:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
2024-04-25 16:46:20 -04:00
|
|
|
RSpec.describe 'Points', type: :request do
|
|
|
|
|
before do
|
|
|
|
|
stub_request(:any, 'https://api.github.com/repos/Freika/dawarich/tags')
|
|
|
|
|
.to_return(status: 200, body: '[{"name": "1.0.0"}]', headers: {})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe 'GET /index' do
|
2024-03-15 19:01:00 -04:00
|
|
|
context 'when user signed in' do
|
|
|
|
|
before do
|
|
|
|
|
sign_in create(:user)
|
|
|
|
|
end
|
|
|
|
|
|
2024-04-25 16:46:20 -04:00
|
|
|
it 'returns http success' do
|
2024-03-15 19:01:00 -04:00
|
|
|
get points_path
|
|
|
|
|
|
|
|
|
|
expect(response).to have_http_status(:success)
|
|
|
|
|
end
|
2024-03-15 18:27:31 -04:00
|
|
|
end
|
|
|
|
|
|
2024-03-15 19:01:00 -04:00
|
|
|
context 'when user not signed in' do
|
2024-04-25 16:46:20 -04:00
|
|
|
it 'returns http success' do
|
2024-03-15 19:01:00 -04:00
|
|
|
get points_path
|
|
|
|
|
|
|
|
|
|
expect(response).to have_http_status(302)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2024-03-15 18:27:31 -04:00
|
|
|
end
|