Deprecate and rename rss_* methods to atom_* methods (#15118).

Patch by Mischa The Evil and Marius BĂLTEANU


git-svn-id: http://svn.redmine.org/redmine/trunk@21467 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu
2022-03-19 09:56:46 +00:00
parent 65a91d13a0
commit f286a6044b
36 changed files with 114 additions and 85 deletions

View File

@@ -20,7 +20,7 @@
class ActivitiesController < ApplicationController
menu_item :activity
before_action :find_optional_project_by_id, :authorize_global
accept_rss_auth :index
accept_atom_auth :index
def index
@days = Setting.activity_days_default.to_i

View File

@@ -33,7 +33,7 @@ class ApplicationController < ActionController::Base
helper :avatars
class_attribute :accept_api_auth_actions
class_attribute :accept_rss_auth_actions
class_attribute :accept_atom_auth_actions
class_attribute :model_object
layout 'base'
@@ -120,9 +120,9 @@ class ApplicationController < ActionController::Base
end
elsif autologin_user = try_to_autologin
user = autologin_user
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
# RSS key authentication does not start a session
user = User.find_by_rss_key(params[:key])
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_atom_auth?
# ATOM key authentication does not start a session
user = User.find_by_atom_key(params[:key])
end
end
if user.nil? && Setting.rest_api_enabled? && accept_api_auth?
@@ -624,16 +624,27 @@ class ApplicationController < ActionController::Base
:content_type => 'application/atom+xml'
end
def self.accept_rss_auth(*actions)
def self.accept_atom_auth(*actions)
if actions.any?
self.accept_rss_auth_actions = actions
self.accept_atom_auth_actions = actions
else
self.accept_rss_auth_actions || []
self.accept_atom_auth_actions || []
end
end
def self.accept_rss_auth(*actions)
ActiveSupport::Deprecation.warn "Application#self.accept_rss_auth is deprecated and will be removed in Redmine 6.0. Please use #self.accept_atom_auth instead."
self.class.accept_atom_auth(*actions)
end
def accept_atom_auth?(action=action_name)
self.class.accept_atom_auth.include?(action.to_sym)
end
# TODO: remove in Redmine 6.0
def accept_rss_auth?(action=action_name)
self.class.accept_rss_auth.include?(action.to_sym)
ActiveSupport::Deprecation.warn "Application#accept_rss_auth? is deprecated and will be removed in Redmine 6.0. Please use #accept_atom_auth? instead."
accept_atom_auth?(action)
end
def self.accept_api_auth(*actions)

View File

@@ -20,7 +20,7 @@
class BoardsController < ApplicationController
default_search_scope :messages
before_action :find_project_by_project_id, :find_board_if_available, :authorize
accept_rss_auth :index, :show
accept_atom_auth :index, :show
helper :sort
include SortHelper

View File

@@ -25,7 +25,7 @@ class IssuesController < ApplicationController
before_action :authorize, :except => [:index, :new, :create]
before_action :find_optional_project, :only => [:index, :new, :create]
before_action :build_new_issue_from_params, :only => [:new, :create]
accept_rss_auth :index, :show
accept_atom_auth :index, :show
accept_api_auth :index, :show, :create, :update, :destroy
rescue_from Query::StatementInvalid, :with => :query_statement_invalid

View File

@@ -22,7 +22,7 @@ class JournalsController < ApplicationController
before_action :find_issue, :only => [:new]
before_action :find_optional_project, :only => [:index]
before_action :authorize, :only => [:new, :edit, :update, :diff]
accept_rss_auth :index
accept_atom_auth :index
menu_item :issues
helper :issues

View File

@@ -26,7 +26,7 @@ class MyController < ApplicationController
accept_api_auth :account
require_sudo_mode :account, only: :put
require_sudo_mode :reset_rss_key, :reset_api_key, :show_api_key, :destroy
require_sudo_mode :reset_atom_key, :reset_api_key, :show_api_key, :destroy
helper :issues
helper :users
@@ -120,18 +120,24 @@ class MyController < ApplicationController
end
# Create a new feeds key
def reset_rss_key
def reset_atom_key
if request.post?
if User.current.rss_token
User.current.rss_token.destroy
if User.current.atom_token
User.current.atom_token.destroy
User.current.reload
end
User.current.rss_key
User.current.atom_key
flash[:notice] = l(:notice_feeds_access_key_reseted)
end
redirect_to my_account_path
end
# TODO: remove in Redmine 6.0
def reset_rss_key
ActiveSupport::Deprecation.warn "My#reset_rss_key is deprecated and will be removed in Redmine 6.0. Please use #reset_atom_key instead."
reset_atom_key
end
def show_api_key
@user = User.current
end

View File

@@ -25,7 +25,7 @@ class NewsController < ApplicationController
before_action :find_project_by_project_id, :only => :create
before_action :authorize, :except => [:index, :new]
before_action :find_optional_project, :only => [:index, :new]
accept_rss_auth :index
accept_atom_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
helper :watchers

View File

@@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
:destroy]
before_action :authorize_global, :only => [:new, :create]
before_action :require_admin, :only => [:copy, :archive, :unarchive]
accept_rss_auth :index
accept_atom_auth :index
accept_api_auth :index, :show, :create, :update, :destroy, :archive, :unarchive, :close, :reopen
require_sudo_mode :destroy
@@ -192,7 +192,7 @@ class ProjectsController < ApplicationController
@total_estimated_hours = Issue.visible.where(cond).sum(:estimated_hours).to_f
end
@key = User.current.rss_key
@key = User.current.atom_key
end
format.api
end

View File

@@ -34,7 +34,7 @@ class RepositoriesController < ApplicationController
before_action :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers]
before_action :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
before_action :authorize
accept_rss_auth :revisions
accept_atom_auth :revisions
accept_api_auth :add_related_issue, :remove_related_issue
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed

View File

@@ -28,7 +28,7 @@ class TimelogController < ApplicationController
before_action :find_optional_issue, :only => [:new, :create]
before_action :find_optional_project, :only => [:index, :report]
accept_rss_auth :index
accept_atom_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
rescue_from Query::StatementInvalid, :with => :query_statement_invalid

View File

@@ -38,7 +38,7 @@ class AnonymousUser < User
def mail=(*args); nil end
def mail; nil end
def time_zone; nil end
def rss_key; nil end
def atom_key; nil end
def pref
UserPreference.new(:user => self)

View File

@@ -87,7 +87,7 @@ class User < Principal
:after_remove => Proc.new {|user, group| group.user_removed(user)}
has_many :changesets, :dependent => :nullify
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
has_one :rss_token, lambda {where "action='feeds'"}, :class_name => 'Token'
has_one :atom_token, lambda {where "action='feeds'"}, :class_name => 'Token'
has_one :api_token, lambda {where "action='api'"}, :class_name => 'Token'
has_one :email_address, lambda {where :is_default => true}, :autosave => true
has_many :email_addresses, :dependent => :delete_all
@@ -415,12 +415,18 @@ class User < Principal
self.pref[:comments_sorting] == 'desc'
end
# Return user's RSS key (a 40 chars long string), used to access feeds
def rss_key
if rss_token.nil?
create_rss_token(:action => 'feeds')
# Return user's ATOM key (a 40 chars long string), used to access feeds
def atom_key
if atom_token.nil?
create_atom_token(:action => 'feeds')
end
rss_token.value
atom_token.value
end
# TODO: remove in Redmine 6.0
def rss_key
ActiveSupport::Deprecation.warn "User.rss_key is deprecated and will be removed in Redmine 6.0. Please use User.atom_key instead."
atom_key
end
# Return user's API key (a 40 chars long string), used to access the API
@@ -530,10 +536,16 @@ class User < Principal
end
end
def self.find_by_rss_key(key)
def self.find_by_atom_key(key)
Token.find_active_user('feeds', key)
end
# TODO: remove in Redmine 6.0
def self.find_by_rss_key(key)
ActiveSupport::Deprecation.warn "User.find_by_rss_key is deprecated and will be removed in Redmine 6.0. Please use User.find_by_atom_key instead."
self.find_by_atom_key(key)
end
def self.find_by_api_key(key)
Token.find_active_user('api', key)
end

View File

@@ -22,11 +22,11 @@
</span>
&nbsp;
<% other_formats_links do |f| %>
<%= f.link_to_with_query_parameters 'Atom', 'from' => nil, :key => User.current.rss_key %>
<%= f.link_to_with_query_parameters 'Atom', 'from' => nil, :key => User.current.atom_key %>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, :params => request.query_parameters.merge(:from => nil, :key => User.current.rss_key), :format => 'atom') %>
<%= auto_discovery_link_tag(:atom, :params => request.query_parameters.merge(:from => nil, :key => User.current.atom_key), :format => 'atom') %>
<% end %>
<% content_for :sidebar do %>

View File

@@ -38,11 +38,11 @@
</table>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_messages => 1, :key => User.current.rss_key} %>
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_messages => 1, :key => User.current.atom_key} %>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.rss_key}) %>
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.atom_key}) %>
<% end %>
<% html_title l(:label_board_plural) %>

View File

@@ -58,10 +58,10 @@
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %>
<% end %>
<% html_title @board.name %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.atom_key}, :title => "#{@project}: #{@board}") %>
<% end %>

View File

@@ -34,7 +34,7 @@
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to_with_query_parameters 'Atom', :key => User.current.rss_key %>
<%= f.link_to_with_query_parameters 'Atom', :key => User.current.atom_key %>
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
<%= f.link_to_with_query_parameters 'PDF' %>
<% end %>
@@ -80,12 +80,12 @@
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom,
{:query_id => @query, :format => 'atom',
:page => nil, :key => User.current.rss_key},
:page => nil, :key => User.current.atom_key},
:title => l(:label_issue_plural)) %>
<%= auto_discovery_link_tag(:atom,
{:controller => 'journals', :action => 'index',
:query_id => @query, :format => 'atom',
:page => nil, :key => User.current.rss_key},
:page => nil, :key => User.current.atom_key},
:title => l(:label_changes_details)) %>
<% end %>

View File

@@ -127,7 +127,7 @@ end %>
<%= render partial: 'action_menu_edit' unless User.current.wants_comments_in_reverse_order? %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %>
<%= f.link_to 'PDF' %>
<% end %>
@@ -145,7 +145,7 @@ end %>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.atom_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %>
<% end %>
<%= context_menu %>

View File

@@ -3,7 +3,7 @@
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.title @title
xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false)
xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.atom_key, :only_path => false)
xml.link "rel" => "alternate", "href" => home_url
xml.id home_url
xml.icon favicon_url

View File

@@ -10,12 +10,12 @@
<h4><%= l(:label_feeds_access_key) %></h4>
<p>
<% if @user.rss_token %>
<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %>
<% if @user.atom_token %>
<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.atom_token.created_on)) %>
<% else %>
<%= l(:label_missing_feeds_access_key) %>
<% end %>
(<%= link_to l(:button_reset), my_rss_key_path, :method => :post %>)
(<%= link_to l(:button_reset), my_atom_key_path, :method => :post %>)
</p>
<% if Setting.rest_api_enabled? %>

View File

@@ -36,6 +36,6 @@
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom,
_project_issues_path(query.project, query.as_params.merge(:format => 'atom', :key => User.current.rss_key)),
_project_issues_path(query.project, query.as_params.merge(:format => 'atom', :key => User.current.atom_key)),
{:title => query.name}) %>
<% end %>

View File

@@ -38,11 +38,11 @@
<span class="pagination"><%= pagination_links_full @news_pages %></span>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.atom_key} %>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, _project_news_path(@project, :key => User.current.rss_key, :format => 'atom')) %>
<%= auto_discovery_link_tag(:atom, _project_news_path(@project, :key => User.current.atom_key, :format => 'atom')) %>
<%= stylesheet_link_tag 'scm' %>
<% end %>

View File

@@ -30,7 +30,7 @@
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %>
<% if @query.display_type == 'list' %>
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '350px'); return false;" %>
<% end %>

View File

@@ -151,7 +151,7 @@
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.atom_key}) %>
<% end %>
<% html_title(l(:label_overview)) -%>

View File

@@ -23,12 +23,12 @@
<%= stylesheet_link_tag "scm" %>
<%= auto_discovery_link_tag(
:atom,
:params => request.query_parameters.merge(:page => nil, :key => User.current.rss_key),
:params => request.query_parameters.merge(:page => nil, :key => User.current.atom_key),
:format => 'atom') %>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %>
<% end %>
<% html_title(l(:label_revision_plural)) -%>

View File

@@ -45,14 +45,14 @@
:atom,
:action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param,
:key => User.current.rss_key) %>
:key => User.current.atom_key) %>
<% end %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom',
:url => {:action => 'revisions', :id => @project,
:repository_id => @repository.identifier_param,
:key => User.current.rss_key} %>
:key => User.current.atom_key} %>
<% end %>
<% end %>
<% end %>

View File

@@ -28,7 +28,7 @@
<span class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></span>
<% other_formats_links do |f| %>
<%= f.link_to_with_query_parameters 'Atom', :key => User.current.rss_key %>
<%= f.link_to_with_query_parameters 'Atom', :key => User.current.atom_key %>
<%= f.link_to_with_query_parameters 'CSV', {}, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
<% end %>
@@ -67,5 +67,5 @@
<% html_title(@query.new_record? ? l(:label_spent_time) : @query.name, l(:label_details)) %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :title => l(:label_spent_time)) %>
<%= auto_discovery_link_tag(:atom, {:issue_id => @issue, :format => 'atom', :key => User.current.atom_key}, :title => l(:label_spent_time)) %>
<% end %>

View File

@@ -122,11 +122,11 @@
<%= render :partial => 'activities/activities', :locals => {:events_by_day => @events_by_day} %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => nil, :user_id => @user, :key => User.current.rss_key} %>
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => nil, :user_id => @user, :key => User.current.atom_key} %>
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :user_id => @user, :format => :atom, :key => User.current.rss_key) %>
<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :user_id => @user, :format => :atom, :key => User.current.atom_key) %>
<% end %>
<% end %>
<%= call_hook :view_account_right_bottom, :user => @user %>

View File

@@ -21,8 +21,8 @@
</div>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.rss_key, :format => 'atom'},
<%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.atom_key, :format => 'atom'},
:title => "#{Setting.app_title}: #{l(:label_news_latest)}") %>
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :key => User.current.rss_key, :format => 'atom'},
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :key => User.current.atom_key, :format => 'atom'},
:title => "#{Setting.app_title}: #{l(:label_activity)}") %>
<% end %>

View File

@@ -29,7 +29,7 @@
<% unless @pages.empty? %>
<% other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.atom_key} %>
<% if User.current.allowed_to?(:export_wiki_pages, @project) %>
<%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %>
<%= f.link_to('HTML', :url => {:action => 'export'}) %>
@@ -38,5 +38,5 @@
<% end %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.atom_key) %>
<% end %>

View File

@@ -25,7 +25,7 @@
<%= f.link_to 'Atom',
:url => {:controller => 'activities', :action => 'index',
:id => @project, :show_wiki_edits => 1,
:key => User.current.rss_key} %>
:key => User.current.atom_key} %>
<% if User.current.allowed_to?(:export_wiki_pages, @project) %>
<%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %>
<%= f.link_to('HTML', :url => {:action => 'export'}) %>
@@ -37,5 +37,5 @@
<%= auto_discovery_link_tag(
:atom, :controller => 'activities', :action => 'index',
:id => @project, :show_wiki_edits => 1, :format => 'atom',
:key => User.current.rss_key) %>
:key => User.current.atom_key) %>
<% end %>

View File

@@ -89,7 +89,7 @@ Rails.application.routes.draw do
match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
get 'my/api_key', :to => 'my#show_api_key', :as => 'my_api_key'
post 'my/api_key', :to => 'my#reset_api_key'
post 'my/rss_key', :to => 'my#reset_rss_key', :as => 'my_rss_key'
post 'my/atom_key', :to => 'my#reset_atom_key', :as => 'my_atom_key'
match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post

View File

@@ -94,7 +94,7 @@ class JournalsControllerTest < Redmine::ControllerTest
:index,
:params => {
:format => 'atom',
:key => user.rss_key
:key => user.atom_key
}
)
@fields.each_with_index do |field, i|

View File

@@ -787,22 +787,22 @@ class MyControllerTest < Redmine::ControllerTest
User.find(2).pref.my_page_layout)
end
def test_reset_rss_key_with_existing_key
@previous_token_value = User.find(2).rss_key # Will generate one if it's missing
post :reset_rss_key
def test_reset_atom_key_with_existing_key
@previous_token_value = User.find(2).atom_key # Will generate one if it's missing
post :reset_atom_key
assert_not_equal @previous_token_value, User.find(2).rss_key
assert User.find(2).rss_token
assert_not_equal @previous_token_value, User.find(2).atom_key
assert User.find(2).atom_token
assert_match /reset/, flash[:notice]
assert_redirected_to '/my/account'
end
def test_reset_rss_key_without_existing_key
def test_reset_atom_key_without_existing_key
Token.delete_all
assert_nil User.find(2).rss_token
post :reset_rss_key
assert_nil User.find(2).atom_token
post :reset_atom_key
assert User.find(2).rss_token
assert User.find(2).atom_token
assert_match /reset/, flash[:notice]
assert_redirected_to '/my/account'
end

View File

@@ -59,8 +59,8 @@ class ApplicationTest < Redmine::IntegrationTest
get '/issues/4.atom'
assert_response 302
rss_key = User.find(2).rss_key
get "/issues/4.atom?key=#{rss_key}"
atom_key = User.find(2).atom_key
get "/issues/4.atom?key=#{atom_key}"
assert_response 200
assert_nil session[:user_id]
end

View File

@@ -33,7 +33,7 @@ class RoutingMyTest < Redmine::RoutingTest
should_route 'GET /my/api_key' => 'my#show_api_key'
should_route 'POST /my/api_key' => 'my#reset_api_key'
should_route 'POST /my/rss_key' => 'my#reset_rss_key'
should_route 'POST /my/atom_key' => 'my#reset_atom_key'
should_route 'GET /my/password' => 'my#password'
should_route 'POST /my/password' => 'my#password'

View File

@@ -798,19 +798,19 @@ class UserTest < ActiveSupport::TestCase
assert_equal 1, anon2.errors.count
end
def test_rss_key
assert_nil @jsmith.rss_token
key = @jsmith.rss_key
def test_atom_key
assert_nil @jsmith.atom_token
key = @jsmith.atom_key
assert_equal 40, key.length
@jsmith.reload
assert_equal key, @jsmith.rss_key
assert_equal key, @jsmith.atom_key
end
def test_rss_key_should_not_be_generated_twice
def test_atom_key_should_not_be_generated_twice
assert_difference 'Token.count', 1 do
key1 = @jsmith.rss_key
key2 = @jsmith.rss_key
key1 = @jsmith.atom_key
key2 = @jsmith.atom_key
assert_equal key1, key2
end
end