diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index ca4b865..68f8f37 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -11,25 +11,4 @@ class MainController < ApplicationController @hydrants = Hydrant.find_closest(@lat, @lng) end end - - def sign_up - @data = {"email" => params[:email], "name" => params[:name]} - respond_to do |format| - format.json{render :json => @data} - end - end - - def sign_in - @data = {"email" => params[:email]} - respond_to do |format| - format.json{render :json => @data} - end - end - - def forgot_password - @data = {"email" => params[:email]} - respond_to do |format| - format.json{render :json => @data} - end - end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..7a8a55a --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,22 @@ +class UsersController < ApplicationController + def sign_up + @data = {"email" => params[:email], "name" => params[:name]} + respond_to do |format| + format.json{render :json => @data} + end + end + + def sign_in + @data = {"email" => params[:email]} + respond_to do |format| + format.json{render :json => @data} + end + end + + def forgot_password + @data = {"email" => params[:email]} + respond_to do |format| + format.json{render :json => @data} + end + end +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/config/routes.rb b/config/routes.rb index 70e239c..e23c0d7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,6 @@ AdoptAHydrant::Application.routes.draw do - get "/javascripts/:action" => "javascripts#action" - post "/sign_up.:format" => "main#sign_up" - post "/sign_in.:format" => "main#sign_in" - post "/forgot_password.:format" => "main#forgot_password" + post "/sign_up.:format" => "users#sign_up", :as => "sign_up" + post "/sign_in.:format" => "users#sign_in", :as => "sign_in" + post "/forgot_password.:format" => "users#forgot_password", :as => "forgot_password" root :to => "main#index" end diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb new file mode 100644 index 0000000..c3db123 --- /dev/null +++ b/test/functional/users_controller_test.rb @@ -0,0 +1,8 @@ +require 'test_helper' + +class UsersControllerTest < ActionController::TestCase + # Replace this with your real tests. + test "the truth" do + assert true + end +end diff --git a/test/unit/helpers/users_helper_test.rb b/test/unit/helpers/users_helper_test.rb new file mode 100644 index 0000000..96af37a --- /dev/null +++ b/test/unit/helpers/users_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class UsersHelperTest < ActionView::TestCase +end