Skip to content

Commit

Permalink
Correctly handle trying to edit not existing settings tab (forem#1011)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredplante authored and benhalpern committed Oct 26, 2018
1 parent bddfc8a commit 2b2a7af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ def handle_settings_tab
%0A
YOUR-DEV-USERNAME-HERE
HEREDOC
else
not_found unless @tab_list.map { |t| t.downcase.gsub(" ", "-") }.include? @tab
end
end
end
5 changes: 5 additions & 0 deletions spec/requests/user_settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
end
end

it "handles unknown settings tab properly" do
expect { get "/settings/does-not-exist" }.
to raise_error(ActionController::RoutingError)
end

it "doesn't let user access membership if user has no monthly_dues" do
get "/settings/membership"
expect(response.body).not_to include("Settings for")
Expand Down

0 comments on commit 2b2a7af

Please sign in to comment.