Add spanish locales and gravatar options
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Applications', type: :controller do
|
||||
subject { ApplicationController.new }
|
||||
|
||||
describe 'after_sign_in_path_for' do
|
||||
it 'returns the user path if the resource is user' do
|
||||
result = subject.after_sign_in_path_for('user')
|
||||
binding.pry
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -3,6 +3,10 @@ FactoryBot.define do
|
||||
sequence( :email ){|i| "test#{i}@example.com" }
|
||||
password { "secret" }
|
||||
|
||||
trait :confirmed do
|
||||
confirmed_at { '2026-03-04T13:44:14Z'.to_time }
|
||||
end
|
||||
|
||||
trait :other_auth do
|
||||
sequence( :email ){|i| "test-other-user#{i}@example.com" }
|
||||
auth_data {{
|
||||
|
||||
+31
-29
@@ -123,7 +123,9 @@ RSpec.configure do |config|
|
||||
#config.mock_with :rspec
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
config.include FactoryAttributesFor
|
||||
config.include Devise::TestHelpers, type: :controller
|
||||
#config.include Devise::TestHelpers, type: :controller
|
||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||
config.include Devise::Test::IntegrationHelpers, type: :request
|
||||
config.include SpecControllerHelpers, type: :controller
|
||||
config.include EndWithMatcher
|
||||
config.include Matchers
|
||||
@@ -142,34 +144,34 @@ RSpec.configure do |config|
|
||||
config.render_views = true
|
||||
config.expect_with(:rspec) { |c| c.syntax = [:expect, :should] }
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
OmniAuth.config.add_mock :facebook, {
|
||||
info: {
|
||||
nickname: 'Joey',
|
||||
name: "Facebook Joe",
|
||||
first_name: "Facebook Joe"
|
||||
},
|
||||
credentials: {
|
||||
'token' => 'fbAuthToken234',
|
||||
'expires_at' => 1.week.from_now.to_i,
|
||||
'expires' => true
|
||||
},
|
||||
uid: '123456790'
|
||||
}
|
||||
|
||||
OmniAuth.config.add_mock :instagram, {
|
||||
info: {
|
||||
nickname: 'Iggy',
|
||||
name: "Instagram Jane",
|
||||
first_name: "Insta"
|
||||
},
|
||||
credentials: {
|
||||
'token' => 'igAuthToken234',
|
||||
'expires_at' => 1.week.from_now.to_i,
|
||||
'expires' => true
|
||||
},
|
||||
uid: '123498765'
|
||||
}
|
||||
# OmniAuth.config.test_mode = true
|
||||
# OmniAuth.config.add_mock :facebook, {
|
||||
# info: {
|
||||
# nickname: 'Joey',
|
||||
# name: "Facebook Joe",
|
||||
# first_name: "Facebook Joe"
|
||||
# },
|
||||
# credentials: {
|
||||
# 'token' => 'fbAuthToken234',
|
||||
# 'expires_at' => 1.week.from_now.to_i,
|
||||
# 'expires' => true
|
||||
# },
|
||||
# uid: '123456790'
|
||||
# }
|
||||
#
|
||||
# OmniAuth.config.add_mock :instagram, {
|
||||
# info: {
|
||||
# nickname: 'Iggy',
|
||||
# name: "Instagram Jane",
|
||||
# first_name: "Insta"
|
||||
# },
|
||||
# credentials: {
|
||||
# 'token' => 'igAuthToken234',
|
||||
# 'expires_at' => 1.week.from_now.to_i,
|
||||
# 'expires' => true
|
||||
# },
|
||||
# uid: '123498765'
|
||||
# }
|
||||
|
||||
# Use color in STDOUT
|
||||
config.color = true
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "UserSignIns", type: :request do
|
||||
describe "GET /users/sign_in" do
|
||||
it "works! (now write some real specs)" do
|
||||
get new_user_session_path
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /users/sign_in' do
|
||||
context 'no user' do
|
||||
it 'shows appropriate message' do
|
||||
post user_session_path, params: {user: {email: 'user435@example.com', password: 'test124'}}
|
||||
# expect(response.redirect_url.to_s).to include '/users/sign_in'
|
||||
# get response.redirect_url
|
||||
expect(response.body).to include 'Invalid email or password'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'unconfirmed user' do
|
||||
let!(:user) { create :user, password: 'test124' }
|
||||
|
||||
it 'shows message indicating that there should be a confirmation' do
|
||||
post user_session_path, params: {user: {email: user.email, password: 'test124'}}
|
||||
expect(response.redirect_url.to_s).to include '/users/sign_in'
|
||||
get response.redirect_url
|
||||
expect(response.body).to include 'You have to confirm your account before continuing'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'confirmed user' do
|
||||
let!(:user) { create :user, :confirmed, password: 'test124' }
|
||||
|
||||
it 'redirects to the user app' do
|
||||
post user_session_path, params: {user: {email: user.email, password: 'test124'}}
|
||||
expect(response.redirect_url).to eq Mozo.user_url
|
||||
expect(response.redirect_url).to eq 'https://user.mozo.bar'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user