* Initial invitation work * Add more invitation code * Add proper registration page * Fix up tests * Fix failings * Fix spec * Add self-serve auth config * Add registered condition * Change profile image call and registered_at test * Change comment * Fix copy test * Stub emojipedia * Linting * Add registered at to factory * Ensure registered for user tag * Update app/views/internal/invitations/index.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/controllers/internal/invitations_controller.rb Co-authored-by: Michael Kohl <citizen428@dev.to> * Slight changes * Update recover password flow * Update app/views/internal/invitations/index.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/controllers/internal/invitations_controller.rb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update db/schema.rb Co-authored-by: Michael Kohl <citizen428@dev.to>
35 lines
931 B
Ruby
35 lines
931 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Registrations", type: :request do
|
|
let(:user) { create(:user) }
|
|
|
|
describe "GET /enter" do
|
|
context "when not logged in" do
|
|
it "shows the sign in page (with self-serve auth)" do
|
|
get "/enter"
|
|
expect(response.body).to include "Great to have you"
|
|
end
|
|
|
|
it "shows the sign in text" do
|
|
get "/enter"
|
|
expect(response.body).to include "If you have a password"
|
|
end
|
|
|
|
it "shows invite-only text if no self-serve" do
|
|
SiteConfig.authentication_providers = []
|
|
get "/enter"
|
|
expect(response.body).to include "If you have a password"
|
|
expect(response.body).not_to include "Sign in by social auth"
|
|
end
|
|
end
|
|
|
|
context "when logged in" do
|
|
it "redirects to /dashboard" do
|
|
sign_in user
|
|
|
|
get "/enter"
|
|
expect(response).to redirect_to("/dashboard")
|
|
end
|
|
end
|
|
end
|
|
end
|