Skip to content

Commit

Permalink
[65] Remove the registration feature (#67)
Browse files Browse the repository at this point in the history
* Omit sign-up link from devise

* Skip registration routes

* Ignore .idea files

* Replace sign-up spec with login
  • Loading branch information
napster235 authored Sep 22, 2023
1 parent 48ac072 commit b409334
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@

# Ignore master key for decrypting credentials and more.
/config/master.key

.idea
21 changes: 21 additions & 0 deletions app/views/devise/shared/_links.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %><br />
<% end %>

<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
<% end %>

<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
<% end %>

<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
<% end %>

<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %><br />
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
devise_for :users
devise_for :users, skip: :registrations

root "home#index"
end
14 changes: 8 additions & 6 deletions spec/system/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
end

describe "sign up flow" do
xit "works" do
visit "/users/sign_up"
let(:user) { FactoryBot.create(:user) }

fill_in "Email", with: "[email protected]"
fill_in "Password", with: "test123"
fill_in "Password confirmation", with: "test123"
it "works" do
visit "/users/sign_in"

expect { click_on "Sign up" }.to change(User, :count).by(1)
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_on "Log in"

expect(page.current_path).to eq(root_path)
end
end
end

0 comments on commit b409334

Please sign in to comment.