From 7dbc3e4774f2c405a7f2784c93160066a6c88303 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 4 Mar 2012 12:15:57 +0000 Subject: [PATCH] Removed some generate! calls. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9078 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/auth_sources_controller_test.rb | 10 +++++----- test/functional/calendars_controller_test.rb | 2 +- test/functional/issues_controller_test.rb | 12 ++++++------ test/unit/mailer_test.rb | 5 +++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb index e3cb1d3b3..e57e801b9 100644 --- a/test/functional/auth_sources_controller_test.rb +++ b/test/functional/auth_sources_controller_test.rb @@ -52,7 +52,7 @@ class AuthSourcesControllerTest < ActionController::TestCase end def test_edit - auth_source = AuthSource.generate!(:name => 'TestEdit') + auth_source = AuthSource.create!(:name => 'TestEdit') get :edit, :id => auth_source.id assert_response :success @@ -61,7 +61,7 @@ class AuthSourcesControllerTest < ActionController::TestCase end def test_update - auth_source = AuthSource.generate!(:name => 'TestEdit') + auth_source = AuthSource.create!(:name => 'TestEdit') post :update, :id => auth_source.id, :auth_source => {:name => 'TestUpdate'} assert_redirected_to '/auth_sources' @@ -69,7 +69,7 @@ class AuthSourcesControllerTest < ActionController::TestCase end def test_destroy_without_users - auth_source = AuthSource.generate!(:name => 'TestEdit') + auth_source = AuthSource.create!(:name => 'TestEdit') assert_difference 'AuthSource.count', -1 do post :destroy, :id => auth_source.id end @@ -78,8 +78,8 @@ class AuthSourcesControllerTest < ActionController::TestCase end def test_destroy_with_users - auth_source = AuthSource.generate!(:name => 'TestEdit') - User.generate!(:auth_source => auth_source) + auth_source = AuthSource.create!(:name => 'TestEdit') + User.find(2).update_attribute :auth_source, auth_source assert_no_difference 'AuthSource.count' do post :destroy, :id => auth_source.id end diff --git a/test/functional/calendars_controller_test.rb b/test/functional/calendars_controller_test.rb index b8c1a6db5..b1402dfb3 100644 --- a/test/functional/calendars_controller_test.rb +++ b/test/functional/calendars_controller_test.rb @@ -25,7 +25,7 @@ class CalendarsControllerTest < ActionController::TestCase context "GET :show" do should "run custom queries" do - @query = Query.generate_default!(:is_public => true) + @query = Query.create!(:name => 'Calendar', :is_public => true) get :show, :query_id => @query.id assert_response :success diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 13cd3679d..168574ebb 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -328,8 +328,8 @@ class IssuesControllerTest < ActionController::TestCase end def test_index_csv_with_spent_time_column - issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :subject => 'test_index_csv_with_spent_time_column') - TimeEntry.generate!(:project_id => issue.project_id, :issue_id => issue.id, :hours => 7.33) + issue = Issue.create!(:project_id => 1, :tracker_id => 1, :subject => 'test_index_csv_with_spent_time_column', :author_id => 2) + TimeEntry.create!(:project => issue.project, :issue => issue, :hours => 7.33, :user => User.find(2), :spent_on => Date.today) get :index, :format => 'csv', :set_filter => '1', :c => %w(subject spent_hours) assert_response :success @@ -957,7 +957,7 @@ class IssuesControllerTest < ActionController::TestCase end def test_show_should_list_subtasks - Issue.generate!(:project_id => 1, :author_id => 1, :tracker_id => 1, :parent_issue_id => 1, :subject => 'Child Issue') + Issue.create!(:project_id => 1, :author_id => 1, :tracker_id => 1, :parent_issue_id => 1, :subject => 'Child Issue') get :show, :id => 1 assert_response :success @@ -966,7 +966,7 @@ class IssuesControllerTest < ActionController::TestCase end def test_show_should_list_parents - issue = Issue.generate!(:project_id => 1, :author_id => 1, :tracker_id => 1, :parent_issue_id => 1, :subject => 'Child Issue') + issue = Issue.create!(:project_id => 1, :author_id => 1, :tracker_id => 1, :parent_issue_id => 1, :subject => 'Child Issue') get :show, :id => issue.id assert_response :success @@ -3085,8 +3085,8 @@ class IssuesControllerTest < ActionController::TestCase end def test_destroy_parent_and_child_issues - parent = Issue.generate!(:project_id => 1, :tracker_id => 1) - child = Issue.generate!(:project_id => 1, :tracker_id => 1, :parent_issue_id => parent.id) + parent = Issue.create!(:project_id => 1, :author_id => 1, :tracker_id => 1, :subject => 'Parent Issue') + child = Issue.create!(:project_id => 1, :author_id => 1, :tracker_id => 1, :subject => 'Child Issue', :parent_issue_id => parent.id) assert child.is_descendant_of?(parent.reload) @request.session[:user_id] = 2 diff --git a/test/unit/mailer_test.rb b/test/unit/mailer_test.rb index 18a045713..8ac1c5a80 100644 --- a/test/unit/mailer_test.rb +++ b/test/unit/mailer_test.rb @@ -476,9 +476,10 @@ class MailerTest < ActiveSupport::TestCase def test_reminders_should_not_include_closed_issues with_settings :default_language => 'en' do - Issue.generate!(:project_id => 1, :tracker_id => 1, :status_id => 5, + Issue.create!(:project_id => 1, :tracker_id => 1, :status_id => 5, :subject => 'Closed issue', :assigned_to_id => 3, - :due_date => 5.days.from_now) + :due_date => 5.days.from_now, + :author_id => 2) ActionMailer::Base.deliveries.clear Mailer.reminders(:days => 42) -- 2.39.5