From eefbb70660ac8b9360b1f9ff48dd9660066cacde Mon Sep 17 00:00:00 2001 From: bsag Date: Sat, 13 May 2006 13:32:39 +0000 Subject: [PATCH] Changed all instances of @response, @request, @session etc. to the new forms or response, request, session etc. Fixes #266 git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@239 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/controllers/context_controller.rb | 20 ++++----- tracks/app/controllers/feed_controller.rb | 44 +++++++++---------- tracks/app/controllers/login_controller.rb | 16 +++---- tracks/app/controllers/note_controller.rb | 6 +-- tracks/app/controllers/project_controller.rb | 20 ++++----- tracks/app/controllers/todo_controller.rb | 20 ++++----- tracks/app/controllers/user_controller.rb | 12 ++--- tracks/app/helpers/login_helper.rb | 2 +- tracks/app/views/context/list.rhtml | 8 ++-- tracks/app/views/feed/rss.rxml | 2 +- tracks/app/views/layouts/login.rhtml | 2 +- tracks/app/views/layouts/scaffold.rhtml | 2 +- tracks/app/views/project/list.rhtml | 8 ++-- tracks/db/schema.rb | 38 ++++++++-------- tracks/lib/login_system.rb | 10 ++--- tracks/test/fixtures/todos.yml | 4 +- .../functional/context_controller_test.rb | 2 +- .../test/functional/feed_controller_test.rb | 2 +- .../test/functional/note_controller_test.rb | 4 +- .../functional/project_controller_test.rb | 2 +- tracks/test/unit/deferred_test.rb | 10 ----- tracks/test/unit/immediate_test.rb | 10 ----- tracks/test/unit/todo_test.rb | 4 +- 23 files changed, 114 insertions(+), 134 deletions(-) delete mode 100644 tracks/test/unit/deferred_test.rb delete mode 100644 tracks/test/unit/immediate_test.rb diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index be13381b..af9f0b1b 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -32,7 +32,7 @@ class ContextController < ApplicationController # def new_context context = @user.contexts.build - context.attributes = @params['context'] + context.attributes = params['context'] context.name = deurlize(context.name) if context.save @@ -49,10 +49,10 @@ class ContextController < ApplicationController def add_item self.init @item = @user.todos.build - @item.attributes = @params["todo"] + @item.attributes = params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) + @item.due = Date.strptime(params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -140,7 +140,7 @@ class ContextController < ApplicationController # def update check_user_set_context - @context.attributes = @params["context"] + @context.attributes = params["context"] @context.name = deurlize(@context.name) if @context.save render_partial 'context_listing', @context @@ -166,7 +166,7 @@ class ContextController < ApplicationController # Methods for changing the sort order of the contexts in the list # def order - @params["list-contexts"].each_with_index do |id, position| + params["list-contexts"].each_with_index do |id, position| if check_user_matches_context_user(id) Context.update(id, :position => position + 1) end @@ -177,10 +177,10 @@ class ContextController < ApplicationController protected def check_user_set_context - if @params["name"] - @context = Context.find_by_name_and_user_id(deurlize(@params["name"]), @user.id) - elsif @params['id'] - @context = Context.find_by_id_and_user_id(@params["id"], @user.id) + if params["name"] + @context = Context.find_by_name_and_user_id(deurlize(params["name"]), @user.id) + elsif params['id'] + @context = Context.find_by_id_and_user_id(params["id"], @user.id) else redirect_to(:controller => "context", :action => "list" ) end @@ -205,7 +205,7 @@ class ContextController < ApplicationController end def check_user_return_item - item = Todo.find( @params['id'] ) + item = Todo.find( params['id'] ) if @user == item.user return item else diff --git a/tracks/app/controllers/feed_controller.rb b/tracks/app/controllers/feed_controller.rb index 8e84dbdc..95ec646e 100644 --- a/tracks/app/controllers/feed_controller.rb +++ b/tracks/app/controllers/feed_controller.rb @@ -14,7 +14,7 @@ class FeedController < ApplicationController # Build an RSS feed def rss prepare_for_feed - @headers["Content-Type"] = "text/xml; charset=utf-8" + headers["Content-Type"] = "text/xml; charset=utf-8" end # Builds a plain text page listing uncompleted next actions, @@ -27,12 +27,12 @@ class FeedController < ApplicationController # def text prepare_for_feed - if @params.key?('context') - @contexts = [ @user.contexts.find(@params['context']) ] + if params.key?('context') + @contexts = [ @user.contexts.find(params['context']) ] else @contexts = @user.contexts.find_all_by_hide(false, "position ASC") end - @headers["Content-Type"] = "text/plain; charset=utf-8" + headers["Content-Type"] = "text/plain; charset=utf-8" end # Builds an iCal compatible export of uncompleted todos @@ -41,32 +41,32 @@ class FeedController < ApplicationController # def ical prepare_for_feed - if @params.key?('context') - @contexts = [ @user.contexts.find(@params['context']) ] + if params.key?('context') + @contexts = [ @user.contexts.find(params['context']) ] else @contexts = @user.contexts.find_all_by_hide(false, "position ASC") end - @headers["Content-Type"] = "text/plain; charset=utf-8" + headers["Content-Type"] = "text/plain; charset=utf-8" end def list_projects_only @projects = @user.projects @description = "Lists all the projects for #{@user.login}." - render :action => 'projects_' + @params['feedtype'] + render :action => 'projects_' + params['feedtype'] end def list_contexts_only @contexts = @user.contexts @description = "Lists all the contexts for #{@user.login}." - render :action => 'contexts_' + @params['feedtype'] + render :action => 'contexts_' + params['feedtype'] end protected # Check whether the token in the URL matches the word in the User's table def check_token_against_user_word - @user = User.find_by_login( @params['name'] ) - unless ( @params['token'] == @user.word) + @user = User.find_by_login( params['name'] ) + unless ( params['token'] == @user.word) render :text => "Sorry, you don't have permission to view this page." return false end @@ -78,15 +78,15 @@ protected condition_builder.add 'todos.done = ?', false - if @params.key?('limit') - options[:limit] = limit = @params['limit'] + if params.key?('limit') + options[:limit] = limit = params['limit'] @description = limit ? "Lists the last #{limit} uncompleted next actions" : "Lists uncompleted next actions" end @title = "Tracks - Next Actions" @description = "Filter: " - if @params.key?('due') - due_within = @params['due'].to_i + if params.key?('due') + due_within = params['due'].to_i condition_builder.add('todos.due <= ?', due_within.days.from_now) due_within_date_s = due_within.days.from_now.strftime("%Y-%m-%d") @title << " due today" if (due_within == 0) @@ -94,15 +94,15 @@ protected @description << " with a due date #{due_within_date_s} or earlier" end - if @params.key?('context') - context = @user.contexts.find(@params['context']) + if params.key?('context') + context = @user.contexts.find(params['context']) condition_builder.add('todos.context_id = ?', context.id) @title << " in #{context.name}" @description << " in context '#{context.name}'" end - if @params.key?('project') - project = @user.projects.find(@params['project']) + if params.key?('project') + project = @user.projects.find(params['project']) condition_builder.add('todos.project_id = ?', project.id) @title << " for #{project.name}" @description << " for project '#{project.name}'" @@ -119,16 +119,16 @@ protected def initialize @queries = Array.new - @params = Array.new + params = Array.new end def add(query, param) @queries << query - @params << param + params << param end def to_conditions - [@queries.join(' AND ')] + @params + [@queries.join(' AND ')] + params end end diff --git a/tracks/app/controllers/login_controller.rb b/tracks/app/controllers/login_controller.rb index 1f651629..add6d0ac 100644 --- a/tracks/app/controllers/login_controller.rb +++ b/tracks/app/controllers/login_controller.rb @@ -5,13 +5,13 @@ class LoginController < ApplicationController def login @page_title = "TRACKS::Login" - case @request.method + case request.method when :post - if @user = User.authenticate(@params['user_login'], @params['user_password']) + if @user = User.authenticate(params['user_login'], params['user_password']) session['user_id'] = @user.id # If checkbox on login page checked, we don't expire the session after 1 hour # of inactivity - session['noexpiry']= @params['user_noexpiry'] + session['noexpiry']= params['user_noexpiry'] if session['noexpiry'] == "on" msg = "will not expire." else @@ -20,7 +20,7 @@ class LoginController < ApplicationController flash['notice'] = "Login successful: session #{msg}" redirect_back_or_default :controller => "todo", :action => "list" else - @login = @params['user_login'] + @login = params['user_login'] flash['warning'] = "Login unsuccessful" end end @@ -56,7 +56,7 @@ class LoginController < ApplicationController end def create - user = User.new(@params['user']) + user = User.new(params['user']) unless user.valid? session['new_user'] = user redirect_to :controller => 'login', :action => 'signup' @@ -65,7 +65,7 @@ class LoginController < ApplicationController user.is_admin = true if User.find_all.empty? if user.save - @user = User.authenticate(user.login, @params['user']['password']) + @user = User.authenticate(user.login, params['user']['password']) @user.preferences = { "date_format" => "%d/%m/%Y", "week_starts" => "1", "no_completed" => "5", "staleness_starts" => "7", "due_style" => "1", "admin_email" => "butshesagirl@rousette.org.uk"} @user.save flash['notice'] = "Signup successful for user #{@user.login}." @@ -74,8 +74,8 @@ class LoginController < ApplicationController end def delete - if @params['id'] and ( @params['id'] = @user.id or @user.is_admin ) - @user = User.find(@params['id']) + if params['id'] and ( params['id'] = @user.id or @user.is_admin ) + @user = User.find(params['id']) # TODO: Maybe it would be better to mark deleted. That way user deletes can be reversed. @user.destroy end diff --git a/tracks/app/controllers/note_controller.rb b/tracks/app/controllers/note_controller.rb index 9a8f4b8f..16be4baf 100644 --- a/tracks/app/controllers/note_controller.rb +++ b/tracks/app/controllers/note_controller.rb @@ -19,7 +19,7 @@ class NoteController < ApplicationController # def add note = @user.notes.build - note.attributes = @params["new_note"] + note.attributes = params["new_note"] if note.save render_partial 'notes_summary', note @@ -40,7 +40,7 @@ class NoteController < ApplicationController def update note = check_user_return_note - note.attributes = @params["note"] + note.attributes = params["note"] if note.save render_partial 'notes', note else @@ -52,7 +52,7 @@ class NoteController < ApplicationController protected def check_user_return_note - note = Note.find_by_id( @params['id'] ) + note = Note.find_by_id( params['id'] ) if @user == note.user return note else diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index 04bd513f..3c972911 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -55,7 +55,7 @@ class ProjectController < ApplicationController def new_project project = @user.projects.build - project.attributes = @params['project'] + project.attributes = params['project'] project.name = deurlize(project.name) if project.save @@ -72,10 +72,10 @@ class ProjectController < ApplicationController def add_item self.init @item = @user.todos.build - @item.attributes = @params["todo"] + @item.attributes = params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) + @item.due = Date.strptime(params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -165,7 +165,7 @@ class ProjectController < ApplicationController # def update check_user_set_project - @project.attributes = @params["project"] + @project.attributes = params["project"] @project.name = deurlize(@project.name) if @project.save render_partial 'project_listing', @project @@ -201,7 +201,7 @@ class ProjectController < ApplicationController # Methods for changing the sort order of the projects in the list # def order - @params["list-projects"].each_with_index do |id, position| + params["list-projects"].each_with_index do |id, position| if check_user_matches_project_user(id) Project.update(id, :position => position + 1) end @@ -212,10 +212,10 @@ class ProjectController < ApplicationController protected def check_user_set_project - if @params["name"] - @project = Project.find_by_name_and_user_id(deurlize(@params["name"]), @user.id) - elsif @params['id'] - @project = Project.find_by_id_and_user_id(@params["id"], @user.id) + if params["name"] + @project = Project.find_by_name_and_user_id(deurlize(params["name"]), @user.id) + elsif params['id'] + @project = Project.find_by_id_and_user_id(params["id"], @user.id) else redirect_to(:controller => "project", :action => "list" ) end @@ -240,7 +240,7 @@ class ProjectController < ApplicationController end def check_user_return_item - item = Todo.find( @params['id'] ) + item = Todo.find( params['id'] ) if @user == item.user return item else diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index f55b5c23..be8f56c6 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -49,10 +49,10 @@ class TodoController < ApplicationController def add_item self.init @item = @user.todos.build - @item.attributes = @params["todo"] + @item.attributes = params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) + @item.due = Date.strptime(params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -87,10 +87,10 @@ class TodoController < ApplicationController # def add_deferred_item self.init - @tickle = Deferred.create(@params["todo"]) + @tickle = Deferred.create(params["todo"]) if @tickle.due? - @tickle.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) + @tickle.due = Date.strptime(params["todo"]["due"], @user.preferences["date_format"]) else @tickle.due = "" end @@ -162,15 +162,15 @@ class TodoController < ApplicationController # def update_action self.init - if @params["on_project_page"] == true + if params["on_project_page"] == true @on_page = "project" end @item = check_user_return_item @original_item_context_id = @item.context_id - @item.attributes = @params["item"] + @item.attributes = params["item"] if @item.due? - @item.due = Date.strptime(@params["item"]["due"], @user.preferences["date_format"]) + @item.due = Date.strptime(params["item"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -182,10 +182,10 @@ class TodoController < ApplicationController #self.init @tickle = check_user_return_item @original_item_context_id = @tickle.context_id - @tickle.attributes = @params["item"] + @tickle.attributes = params["item"] if @tickle.due? - @tickle.due = Date.strptime(@params["item"]["due"], @user.preferences["date_format"]) + @tickle.due = Date.strptime(params["item"]["due"], @user.preferences["date_format"]) else @tickle.due = "" end @@ -280,7 +280,7 @@ class TodoController < ApplicationController protected def check_user_return_item - item = Todo.find( @params['id'] ) + item = Todo.find( params['id'] ) if @user == item.user return item else diff --git a/tracks/app/controllers/user_controller.rb b/tracks/app/controllers/user_controller.rb index adefc6eb..11ce5719 100644 --- a/tracks/app/controllers/user_controller.rb +++ b/tracks/app/controllers/user_controller.rb @@ -23,12 +23,12 @@ class UserController < ApplicationController end def update_preferences - @user.preferences = { "date_format" => "#{@params['prefs']['date_format']}", - "week_starts" => "#{@params['prefs']['week_starts']}", - "no_completed" => "#{@params['prefs']['no_completed']}", - "staleness_starts" => "#{@params['prefs']['staleness_starts']}", - "due_style" => "#{@params['prefs']['due_style']}", - "admin_email" => "#{@params['prefs']['admin_email']}" + @user.preferences = { "date_format" => "#{params['prefs']['date_format']}", + "week_starts" => "#{params['prefs']['week_starts']}", + "no_completed" => "#{params['prefs']['no_completed']}", + "staleness_starts" => "#{params['prefs']['staleness_starts']}", + "due_style" => "#{params['prefs']['due_style']}", + "admin_email" => "#{params['prefs']['admin_email']}" } if @user.save redirect_to :action => 'preferences' diff --git a/tracks/app/helpers/login_helper.rb b/tracks/app/helpers/login_helper.rb index 72c3e2b5..bffb636c 100644 --- a/tracks/app/helpers/login_helper.rb +++ b/tracks/app/helpers/login_helper.rb @@ -3,7 +3,7 @@ module LoginHelper def render_errors(obj) return "" unless obj - return "" unless @request.post? + return "" unless request.post? tag = String.new unless obj.valid? diff --git a/tracks/app/views/context/list.rhtml b/tracks/app/views/context/list.rhtml index 46df24cc..66c29c07 100644 --- a/tracks/app/views/context/list.rhtml +++ b/tracks/app/views/context/list.rhtml @@ -38,11 +38,11 @@ -<% if @flash["confirmation"] %> -
<%= @flash["confirmation"] %>
+<% if flash["confirmation"] %> +
<%= flash["confirmation"] %>
<% end %> -<% if @flash["warning"] %> -
<%= @flash["warning"] %>
+<% if flash["warning"] %> +
<%= flash["warning"] %>
<% end %> \ No newline at end of file diff --git a/tracks/app/views/feed/rss.rxml b/tracks/app/views/feed/rss.rxml index edf21681..7f4eee01 100644 --- a/tracks/app/views/feed/rss.rxml +++ b/tracks/app/views/feed/rss.rxml @@ -1,7 +1,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do xml.channel do xml.title(@title) - xml.link("http://#{@request.host}:#{@request.port}/todo/list") + xml.link("http://#{request.host}:#{request.port}/todo/list") xml.description(@description) @todos.each { |i| xml.item do diff --git a/tracks/app/views/layouts/login.rhtml b/tracks/app/views/layouts/login.rhtml index 93ab60e8..f7814e2e 100644 --- a/tracks/app/views/layouts/login.rhtml +++ b/tracks/app/views/layouts/login.rhtml @@ -8,7 +8,7 @@ -<%= @content_for_layout %> +<%= yield %> -<% if @flash["confirmation"] %> -
<%= @flash["confirmation"] %>
+<% if flash["confirmation"] %> +
<%= flash["confirmation"] %>
<% end %> -<% if @flash["warning"] %> -
<%= @flash["warning"] %>
+<% if flash["warning"] %> +
<%= flash["warning"] %>
<% end %> \ No newline at end of file diff --git a/tracks/db/schema.rb b/tracks/db/schema.rb index 82f00e2e..f3aa4036 100644 --- a/tracks/db/schema.rb +++ b/tracks/db/schema.rb @@ -5,26 +5,26 @@ ActiveRecord::Schema.define(:version => 8) do create_table "contexts", :force => true do |t| - t.column "name", :string, :null => false - t.column "position", :integer, :null => false - t.column "hide", :boolean, :default => false + t.column "name", :string, :default => "", :null => false + t.column "hide", :integer, :limit => 4, :default => 0, :null => false + t.column "position", :integer, :default => 0, :null => false t.column "user_id", :integer, :default => 1 end create_table "notes", :force => true do |t| - t.column "user_id", :integer, :null => false - t.column "project_id", :integer, :null => false + t.column "user_id", :integer, :default => 0, :null => false + t.column "project_id", :integer, :default => 0, :null => false t.column "body", :text - t.column "created_at", :datetime, :default => Sat Jan 01 00:00:00 GMT 2000 - t.column "updated_at", :datetime, :default => Sat Jan 01 00:00:00 GMT 2000 + t.column "created_at", :datetime + t.column "updated_at", :datetime end create_table "projects", :force => true do |t| - t.column "name", :string, :null => false - t.column "position", :integer, :null => false - t.column "done", :boolean, :default => false + t.column "name", :string, :default => "", :null => false + t.column "position", :integer, :default => 0, :null => false + t.column "done", :integer, :limit => 4, :default => 0, :null => false t.column "user_id", :integer, :default => 1 - t.column "description", :text, :default => "" + t.column "description", :text end create_table "sessions", :force => true do |t| @@ -36,24 +36,24 @@ ActiveRecord::Schema.define(:version => 8) do add_index "sessions", ["session_id"], :name => "sessions_session_id_index" create_table "todos", :force => true do |t| - t.column "context_id", :integer, :null => false - t.column "project_id", :integer - t.column "description", :string, :null => false + t.column "context_id", :integer, :default => 0, :null => false + t.column "description", :string, :limit => 100, :default => "", :null => false t.column "notes", :text - t.column "done", :boolean, :default => false, :null => false - t.column "created_at", :datetime, :default => Sat Jan 01 00:00:00 GMT 2000 + t.column "done", :integer, :limit => 4, :default => 0, :null => false + t.column "created_at", :datetime t.column "due", :date t.column "completed", :datetime + t.column "project_id", :integer t.column "user_id", :integer, :default => 1 t.column "type", :string, :default => "Immediate", :null => false t.column "show_from", :date end create_table "users", :force => true do |t| - t.column "login", :string, :limit => 80, :null => false - t.column "password", :string, :limit => 40, :null => false + t.column "login", :string, :limit => 80 + t.column "password", :string, :limit => 40 t.column "word", :string - t.column "is_admin", :boolean, :default => false, :null => false + t.column "is_admin", :integer, :limit => 4, :default => 0, :null => false t.column "preferences", :text end diff --git a/tracks/lib/login_system.rb b/tracks/lib/login_system.rb index 32a7f378..eb650973 100644 --- a/tracks/lib/login_system.rb +++ b/tracks/lib/login_system.rb @@ -46,7 +46,7 @@ module LoginSystem return true end - if @session['user_id'] and authorize?(User.find(@session['user_id'])) + if session['user_id'] and authorize?(User.find(session['user_id'])) return true end @@ -75,16 +75,16 @@ module LoginSystem # store current uri in the session. # we can return to this location by calling return_location def store_location - @session['return-to'] = @request.request_uri + session['return-to'] = request.request_uri end # move to the last store_location call or to the passed default one def redirect_back_or_default(default) - if @session['return-to'].nil? + if session['return-to'].nil? redirect_to default else - redirect_to_url @session['return-to'] - @session['return-to'] = nil + redirect_to_url session['return-to'] + session['return-to'] = nil end end diff --git a/tracks/test/fixtures/todos.yml b/tracks/test/fixtures/todos.yml index 04ac4eef..00cf8449 100644 --- a/tracks/test/fixtures/todos.yml +++ b/tracks/test/fixtures/todos.yml @@ -122,10 +122,10 @@ end project_id: ~ description: Upgrade to Rails 0.9.1 notes: ~ - done: <%= b_false %> + done: <%= b_true %> created_at: <%= today %> due: <%= today %> - completed: ~ + completed: <%= today %> user_id: 1 9: diff --git a/tracks/test/functional/context_controller_test.rb b/tracks/test/functional/context_controller_test.rb index 50889fa8..15929e29 100644 --- a/tracks/test/functional/context_controller_test.rb +++ b/tracks/test/functional/context_controller_test.rb @@ -7,7 +7,7 @@ class ContextController; def rescue_action(e) raise e end; end class ContextControllerTest < Test::Unit::TestCase def setup @controller = ContextController.new - @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new + request, response = ActionController::TestRequest.new, ActionController::TestResponse.new end # Replace this with your real tests. diff --git a/tracks/test/functional/feed_controller_test.rb b/tracks/test/functional/feed_controller_test.rb index ec035b24..badb49ef 100644 --- a/tracks/test/functional/feed_controller_test.rb +++ b/tracks/test/functional/feed_controller_test.rb @@ -7,7 +7,7 @@ class FeedController; def rescue_action(e) raise e end; end class FeedControllerTest < Test::Unit::TestCase def setup @controller = FeedController.new - @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new + request, response = ActionController::TestRequest.new, ActionController::TestResponse.new end # Replace this with your real tests. diff --git a/tracks/test/functional/note_controller_test.rb b/tracks/test/functional/note_controller_test.rb index 7a398cdf..6b76f0ee 100644 --- a/tracks/test/functional/note_controller_test.rb +++ b/tracks/test/functional/note_controller_test.rb @@ -7,8 +7,8 @@ class NoteController; def rescue_action(e) raise e end; end class NoteControllerTest < Test::Unit::TestCase def setup @controller = NoteController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new + request = ActionController::TestRequest.new + response = ActionController::TestResponse.new end # Replace this with your real tests. diff --git a/tracks/test/functional/project_controller_test.rb b/tracks/test/functional/project_controller_test.rb index 330dbef5..b1eec90e 100644 --- a/tracks/test/functional/project_controller_test.rb +++ b/tracks/test/functional/project_controller_test.rb @@ -7,7 +7,7 @@ class ProjectController; def rescue_action(e) raise e end; end class ProjectControllerTest < Test::Unit::TestCase def setup @controller = ProjectController.new - @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new + request, response = ActionController::TestRequest.new, ActionController::TestResponse.new end # Replace this with your real tests. diff --git a/tracks/test/unit/deferred_test.rb b/tracks/test/unit/deferred_test.rb deleted file mode 100644 index db0b92a1..00000000 --- a/tracks/test/unit/deferred_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class DeferredTest < Test::Unit::TestCase - fixtures :deferreds - - # Replace this with your real tests. - def test_truth - assert true - end -end diff --git a/tracks/test/unit/immediate_test.rb b/tracks/test/unit/immediate_test.rb deleted file mode 100644 index 9288c0f4..00000000 --- a/tracks/test/unit/immediate_test.rb +++ /dev/null @@ -1,10 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class ImmediateTest < Test::Unit::TestCase - fixtures :immediates - - # Replace this with your real tests. - def test_truth - assert true - end -end diff --git a/tracks/test/unit/todo_test.rb b/tracks/test/unit/todo_test.rb index 4bb46c6f..d556267a 100644 --- a/tracks/test/unit/todo_test.rb +++ b/tracks/test/unit/todo_test.rb @@ -19,8 +19,8 @@ class TodoTest < Test::Unit::TestCase assert_equal "Call Bill Gates to find out how much he makes per day", @not_completed1.description assert_nil @not_completed1.notes assert_equal 0, @not_completed1.done - assert_equal "2004-11-28 16:01:00", @not_completed1.created_at.strftime("%Y-%m-%d %H:%M:%S") - assert_equal "2004-10-30", @not_completed1.due.strftime("%Y-%m-%d") + assert_equal 1.week.ago.to_s(:db), @not_completed1.created_at.strftime("%Y-%m-%d %H:%M:%S") + assert_equal 2.week.from_now.strftime("%Y-%m-%d"), @not_completed1.due.strftime("%Y-%m-%d") assert_nil @not_completed1.completed assert_equal 1, @not_completed1.user_id end