app/controllers/application_controller.rb | 2 +- app/controllers/my_controller.rb | 15 +++++++++---- app/controllers/projects_controller.rb | 2 +- app/models/user.rb | 28 +++++++++++++++++------- app/views/activities/index.html.erb | 4 ++-- app/views/boards/index.html.erb | 4 ++-- app/views/boards/show.html.erb | 4 ++-- app/views/issues/index.html.erb | 6 ++--- app/views/issues/show.html.erb | 4 ++-- app/views/journals/index.builder | 2 +- app/views/my/_sidebar.html.erb | 6 ++--- app/views/my/blocks/_issuesassignedtome.html.erb | 2 +- app/views/my/blocks/_issuesreportedbyme.html.erb | 2 +- app/views/news/index.html.erb | 4 ++-- app/views/projects/index.html.erb | 4 ++-- app/views/projects/show.html.erb | 2 +- app/views/repositories/revisions.html.erb | 4 ++-- app/views/repositories/show.html.erb | 4 ++-- app/views/timelog/index.html.erb | 4 ++-- app/views/users/show.html.erb | 4 ++-- app/views/welcome/index.html.erb | 4 ++-- app/views/wiki/date_index.html.erb | 4 ++-- app/views/wiki/index.html.erb | 4 ++-- config/routes.rb | 2 +- test/functional/my_controller_test.rb | 18 +++++++-------- test/integration/application_test.rb | 4 ++-- test/integration/routing/my_test.rb | 4 ++-- test/unit/user_test.rb | 14 ++++++------ 28 files changed, 90 insertions(+), 71 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6bbc4d1..2f1d444 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -100,7 +100,7 @@ class ApplicationController < ActionController::Base 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]) + user = User.find_by_atom_key(params[:key]) end end if user.nil? && Setting.rest_api_enabled? && accept_api_auth? diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 84f5b20..861be3a 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -105,17 +105,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 3.0 + def reset_rss_key + ActiveSupport::Deprecation.warn "My#reset_rss_key is deprecated and will be removed in Redmine 3.0. Please use #reset_atom_key instead." + reset_atom_key + end + # Create a new API key def reset_api_key diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 4b1befd..d9f983e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -158,7 +158,7 @@ class ProjectsController < ApplicationController @total_hours = TimeEntry.visible.sum(:hours, :include => :project, :conditions => cond).to_f end - @key = User.current.rss_key + @key = User.current.atom_key respond_to do |format| format.html diff --git a/app/models/user.rb b/app/models/user.rb index 25cfeba..726de74 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -72,7 +72,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, :class_name => 'Token', :conditions => "action='feeds'" + has_one :atom_token, :class_name => 'Token', :conditions => "action='feeds'" has_one :api_token, :class_name => 'Token', :conditions => "action='api'" belongs_to :auth_source @@ -303,12 +303,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 3.0 + def rss_key + ActiveSupport::Deprecation.warn "User.rss_key is deprecated and will be removed in Redmine 3.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 @@ -361,10 +367,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 3.0 + def self.find_by_rss_key(key) + ActiveSupport::Deprecation.warn "User.find_by_rss_key is deprecated and will be removed in Redmine 3.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 @@ -698,7 +710,7 @@ class AnonymousUser < User def name(*args); I18n.t(:label_user_anonymous) 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) diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index 7522e4b..6176b15 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -33,11 +33,11 @@   <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %> + <%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.atom_key) %> <% end %> <% content_for :header_tags do %> -<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %> +<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.atom_key)) %> <% end %> <% content_for :sidebar do %> diff --git a/app/views/boards/index.html.erb b/app/views/boards/index.html.erb index f859e82..41f4798 100644 --- a/app/views/boards/index.html.erb +++ b/app/views/boards/index.html.erb @@ -28,11 +28,11 @@ <% 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) %> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index f5e9b12..42477f3 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -56,11 +56,11 @@ <% 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 %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 0e4f940..b443622 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -64,7 +64,7 @@ <% end %> <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %> + <%= f.link_to 'Atom', :url => params.merge(:key => User.current.atom_key) %> <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> <%= f.link_to 'PDF', :url => params %> <% end %> @@ -96,12 +96,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 %> diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 83b4f56..e7cec08 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -134,7 +134,7 @@ end %> <% 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} %> <%= f.link_to 'PDF' %> <% end %> @@ -152,7 +152,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 issues_context_menu_path %> diff --git a/app/views/journals/index.builder b/app/views/journals/index.builder index a81ff98..038ac6e 100644 --- a/app/views/journals/index.builder +++ b/app/views/journals/index.builder @@ -1,7 +1,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(:only_path => false) xml.id url_for(:controller => 'welcome', :only_path => false) xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema) diff --git a/app/views/my/_sidebar.html.erb b/app/views/my/_sidebar.html.erb index 4c9270f..b7a5e5f 100644 --- a/app/views/my/_sidebar.html.erb +++ b/app/views/my/_sidebar.html.erb @@ -10,12 +10,12 @@

<%= l(:label_feeds_access_key) %>

-<% 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), {:action => 'reset_rss_key'}, :method => :post %>) +(<%= link_to l(:button_reset), {:action => 'reset_atom_key'}, :method => :post %>)

<% if Setting.rest_api_enabled? %> diff --git a/app/views/my/blocks/_issuesassignedtome.html.erb b/app/views/my/blocks/_issuesassignedtome.html.erb index 02d8c9a..4f3a0fc 100644 --- a/app/views/my/blocks/_issuesassignedtome.html.erb +++ b/app/views/my/blocks/_issuesassignedtome.html.erb @@ -13,6 +13,6 @@ <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:controller => 'issues', :action => 'index', :set_filter => 1, - :assigned_to_id => 'me', :format => 'atom', :key => User.current.rss_key}, + :assigned_to_id => 'me', :format => 'atom', :key => User.current.atom_key}, {:title => l(:label_assigned_to_me_issues)}) %> <% end %> diff --git a/app/views/my/blocks/_issuesreportedbyme.html.erb b/app/views/my/blocks/_issuesreportedbyme.html.erb index 06bbda7..eaf2831 100644 --- a/app/views/my/blocks/_issuesreportedbyme.html.erb +++ b/app/views/my/blocks/_issuesreportedbyme.html.erb @@ -14,6 +14,6 @@ <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:controller => 'issues', :action => 'index', :set_filter => 1, - :author_id => 'me', :format => 'atom', :key => User.current.rss_key}, + :author_id => 'me', :format => 'atom', :key => User.current.atom_key}, {:title => l(:label_reported_issues)}) %> <% end %> diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb index 38eecd2..4ddda97 100644 --- a/app/views/news/index.html.erb +++ b/app/views/news/index.html.erb @@ -35,11 +35,11 @@

<%= pagination_links_full @news_pages %>

<% 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, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> + <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.atom_key})) %> <%= stylesheet_link_tag 'scm' %> <% end %> diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb index 621ffd5..f24be13 100644 --- a/app/views/projects/index.html.erb +++ b/app/views/projects/index.html.erb @@ -1,5 +1,5 @@ <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> + <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.atom_key}) %> <% end %>
@@ -24,7 +24,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} %> <% end %> <% content_for :sidebar do %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 8452a02..5d7228f 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -91,7 +91,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)) -%> diff --git a/app/views/repositories/revisions.html.erb b/app/views/repositories/revisions.html.erb index a1e5458..1f915a6 100644 --- a/app/views/repositories/revisions.html.erb +++ b/app/views/repositories/revisions.html.erb @@ -24,11 +24,11 @@ <%= auto_discovery_link_tag( :atom, params.merge( - {:format => 'atom', :page => nil, :key => User.current.rss_key})) %> + {:format => 'atom', :page => nil, :key => User.current.atom_key})) %> <% 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)) -%> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index fcf0a0e..246dc06 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -44,14 +44,14 @@ <%= auto_discovery_link_tag( :atom, params.merge( {:format => 'atom', :action => 'revisions', - :id => @project, :page => nil, :key => User.current.rss_key})) %> + :id => @project, :page => nil, :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 %> diff --git a/app/views/timelog/index.html.erb b/app/views/timelog/index.html.erb index 35ddf81..a794681 100644 --- a/app/views/timelog/index.html.erb +++ b/app/views/timelog/index.html.erb @@ -21,7 +21,7 @@

<%= pagination_links_full @entry_pages, @entry_count %>

<% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %> + <%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.atom_key}) %> <%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %> <% end %> @@ -43,5 +43,5 @@ <% html_title l(:label_spent_time), 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 %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 8c32235..196af67 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -59,11 +59,11 @@
<% 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 %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 064066a..fac2cec 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -32,8 +32,8 @@ <% 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 %> diff --git a/app/views/wiki/date_index.html.erb b/app/views/wiki/date_index.html.erb index a543ef2..40558e4 100644 --- a/app/views/wiki/date_index.html.erb +++ b/app/views/wiki/date_index.html.erb @@ -23,7 +23,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'}) %> @@ -32,5 +32,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 %> diff --git a/app/views/wiki/index.html.erb b/app/views/wiki/index.html.erb index 333cc85..4fecb24 100644 --- a/app/views/wiki/index.html.erb +++ b/app/views/wiki/index.html.erb @@ -19,7 +19,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'}) %> @@ -31,5 +31,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 %> diff --git a/config/routes.rb b/config/routes.rb index 7d0ff85..26639b0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -64,7 +64,7 @@ RedmineApp::Application.routes.draw do match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] match 'my/page', :controller => 'my', :action => 'page', :via => :get match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page - match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post + match 'my/reset_atom_key', :controller => 'my', :action => 'reset_atom_key', :via => :post match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb index 7e96770..49b44f6 100644 --- a/test/functional/my_controller_test.rb +++ b/test/functional/my_controller_test.rb @@ -208,21 +208,21 @@ class MyControllerTest < ActionController::TestCase assert_equal ['documents', 'calendar', 'latestnews'], User.find(2).pref[:my_page_layout]['left'] 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 - assert_nil User.find(2).rss_token - post :reset_rss_key + def test_reset_atom_key_without_existing_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 diff --git a/test/integration/application_test.rb b/test/integration/application_test.rb index 409dcfd..d3465b7 100644 --- a/test/integration/application_test.rb +++ b/test/integration/application_test.rb @@ -54,8 +54,8 @@ class ApplicationTest < ActionController::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 diff --git a/test/integration/routing/my_test.rb b/test/integration/routing/my_test.rb index 71c824f..98fd813 100644 --- a/test/integration/routing/my_test.rb +++ b/test/integration/routing/my_test.rb @@ -40,8 +40,8 @@ class RoutingMyTest < ActionController::IntegrationTest { :controller => 'my', :action => 'index' } ) assert_routing( - { :method => 'post', :path => "/my/reset_rss_key" }, - { :controller => 'my', :action => 'reset_rss_key' } + { :method => 'post', :path => "/my/reset_atom_key" }, + { :controller => 'my', :action => 'reset_atom_key' } ) assert_routing( { :method => 'post', :path => "/my/reset_api_key" }, diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 230e5b1..bd146c4 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -659,19 +659,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