Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
AO3-4934 Extend kudos feature and rspec tests #3150
Conversation
| @@ -23,7 +23,7 @@ def create | ||
| format.html do | ||
| flash[:comment_notice] = ts("Thank you for leaving kudos!") | ||
| - redirect_to request.referer and return | ||
| + redirect_to request.referer || root_path and return |
| @@ -48,7 +48,7 @@ def create | ||
| error_message = "You can't leave guest kudos on a restricted work." | ||
| end | ||
| flash[:comment_error] = ts(error_message) | ||
| - redirect_to request.referer and return | ||
| + redirect_to request.referer || root_path and return |
| @@ -116,6 +116,8 @@ def path_to(page_name) | ||
| user_works_path(user_id: $1) | ||
| when /^the "(.*)" work page/ | ||
| work_path(Work.find_by(title: $1)).sub("http://www.example.com", "//") | ||
| + when /^the "(.*)" work kudos page/ |
| @@ -0,0 +1,40 @@ | ||
| +require 'spec_helper' |
| @@ -0,0 +1,40 @@ | ||
| +require 'spec_helper' | ||
| + | ||
| +describe KudosController do |
| + include LoginMacros | ||
| + include RedirectExpectationHelper | ||
| + | ||
| + describe 'create' do |
| + end | ||
| + end | ||
| + end | ||
| +end |
| @@ -23,7 +23,7 @@ def create | ||
| format.html do | ||
| flash[:comment_notice] = ts("Thank you for leaving kudos!") | ||
| - redirect_to request.referer and return | ||
| + redirect_to (request.referer || root_path) && return |
| @@ -48,7 +48,7 @@ def create | ||
| error_message = "You can't leave guest kudos on a restricted work." | ||
| end | ||
| flash[:comment_error] = ts(error_message) | ||
| - redirect_to request.referer and return | ||
| + redirect_to (request.referer || root_path) && return |
| @@ -0,0 +1,41 @@ | ||
| +# frozen_string_literal: true | ||
| +require 'spec_helper' |
sarken
added
the
Awaiting review
label
Nov 8, 2017
|
Please do not bother reviewing until I've fixed the tests. |
hatal175
added some commits
Nov 9, 2017
| @@ -23,7 +23,7 @@ def create | ||
| format.html do | ||
| flash[:comment_notice] = ts("Thank you for leaving kudos!") | ||
| - redirect_to request.referer and return | ||
| + redirect_to request.referer || root_path and return |
sarken
Nov 12, 2017
Owner
I'm not sure root_path is a good fallback for kudos -- if we can't redirect someone back to the exact referrer (which could be something like a specific chapter of the work they're kudosing or the work's kudos), we should at least redirect them to work.
| - redirect_to request.referer and return | ||
| + redirect_to request.referer || redirect_path and return |
| + | ||
| +require 'spec_helper' | ||
| + | ||
| +describe KudosController do |
| + include LoginMacros | ||
| + include RedirectExpectationHelper | ||
| + | ||
| + describe 'create' do |
| + include RedirectExpectationHelper | ||
| + | ||
| + describe 'create' do | ||
| + context "when a regular work is posted" do |
| + end | ||
| + end | ||
| + | ||
| + |
| + end | ||
| + | ||
| + | ||
| + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hatal175 commentedNov 8, 2017
Issue
https://otwarchive.atlassian.net/browse/AO3-4934
Purpose
Completed coverage for the kudos controller
Testing
No new features just tests. Run them :)
Credit
Tal Hayon
Please use he