Skip to content

Commit

Permalink
take out static_pages from url for membersonly
Browse files Browse the repository at this point in the history
  • Loading branch information
christophwong committed Oct 9, 2018
1 parent c92419a commit adda873
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<nav>
<ul>
<li><%= link_to "home", root_path, :class => "active" %></li>
<li><%= link_to "members", static_pages_members_only_path %></li>
<li><%= link_to "members", members_only_path %></li>
<li><%= link_to "admin", static_pages_admin_only_path %></li>
<li><%= link_to "Sign Out", users.sign_out_path, method: :delete %></li>
<li><%= link_to "Sign In", users.sign_in_path %></li>
Expand Down
6 changes: 3 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Rails.application.routes.draw do
root to: "static_pages#home"
root "static_pages#home"

get 'static_pages/members_only'
get 'static_pages/admin_only'
get '/members_only', to: "static_pages#members_only"
get 'static_pages/admin_only'
passwordless_for :users
end
9 changes: 9 additions & 0 deletions test/controllers/router_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'test_helper'

class RouterTest < ActionDispatch::IntegrationTest
test 'routes' do
assert_routing '/', controller: 'static_pages', action: 'home'
assert_routing '/members_only', controller: 'static_pages', action: 'members_only'
# assert_routing '/admins_only', controller: 'static_pages', action: 'admins_only'
end
end

0 comments on commit adda873

Please sign in to comment.