This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class Users::RegistrationsController < Devise::RegistrationsController | |
# before_action :configure_sign_up_params, only: [:create] | |
# before_action :configure_account_update_params, only: [:update] | |
# GET /resource/sign_up | |
# def new | |
# super | |
# end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RegistrationsController < Devise::RegistrationsController | |
# before_action :configure_sign_up_params, only: [:create] | |
# before_action :configure_account_update_params, only: [:update] | |
# GET /resource/sign_up | |
# def new | |
# super | |
# end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RegistrationsController < Devise::RegistrationsController | |
# before_action :configure_sign_up_params, only: [:create] | |
# before_action :configure_account_update_params, only: [:update] | |
# GET /resource/sign_up | |
# def new | |
# super | |
# end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Sign up</h2> | |
<%= simple_form_for(resource, as: resource_name, url: user_registration_path) do |f| %> | |
<%= f.error_notification %> | |
<div class="form-inputs"> | |
<%= f.input :email, | |
required: true, | |
autofocus: true, | |
input_html: { autocomplete: "email" }%> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Sign up</h2> | |
<%= simple_form_for(resource, as: resource_name, url: user_registration_path) do |f| %> | |
<%= f.error_notification %> | |
<div class="form-inputs"> | |
<%= f.input :email, | |
required: true, | |
autofocus: true, | |
input_html: { autocomplete: "email" }%> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative "database" | |
require "test/unit" | |
require 'objspace' | |
class TestDatabase < Test::Unit::TestCase | |
def test_get_set_happy_path | |
#These two methods are tested together because isolating them would require opening direct access to database objects. | |
db = Database.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Database | |
def initialize | |
@db = Hash.new() | |
end | |
# CRUD COMMANDS | |
def set(key, value) | |
@db[key] = value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
def test_count_happy_path | |
db = Database.new | |
db.set "Snowy", "Owl" | |
assert_equal(1, db.count("Owl")) | |
db.set "GreatHorned", "Owl" | |
assert_equal(2, db.count("Owl")) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Database | |
def initialize | |
@count = Hash.new(0) | |
@db = Hash.new() | |
end | |
# CRUD COMMANDS | |
def set(key, value) | |
@db[key] = value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
def test_delete_happy_path | |
db = Database.new | |
db.set "Tufted", "Titmouse" | |
assert_equal("Titmouse", db.get("Tufted")) | |
db.delete "Tufted" | |
assert_equal("NULL", db.get("Tufted")) |