@@ -258,7 +258,7 class CustomField < ActiveRecord::Base | |||
|
258 | 258 | |
|
259 | 259 | # to move in project_custom_field |
|
260 | 260 | def self.for_all |
|
261 | find(:all, :conditions => ["is_for_all=?", true], :order => 'position') | |
|
261 | where(:is_for_all => true).order('position').all | |
|
262 | 262 | end |
|
263 | 263 | |
|
264 | 264 | def type_name |
@@ -62,8 +62,11 class Group < Principal | |||
|
62 | 62 | |
|
63 | 63 | def user_removed(user) |
|
64 | 64 | members.each do |member| |
|
65 | MemberRole.find(:all, :include => :member, | |
|
66 | :conditions => ["#{Member.table_name}.user_id = ? AND #{MemberRole.table_name}.inherited_from IN (?)", user.id, member.member_role_ids]).each(&:destroy) | |
|
65 | MemberRole. | |
|
66 | includes(:member). | |
|
67 | where("#{Member.table_name}.user_id = ? AND #{MemberRole.table_name}.inherited_from IN (?)", user.id, member.member_role_ids). | |
|
68 | all. | |
|
69 | each(&:destroy) | |
|
67 | 70 | end |
|
68 | 71 | end |
|
69 | 72 |
@@ -281,7 +281,7 class MailHandler < ActionMailer::Base | |||
|
281 | 281 | if user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project) |
|
282 | 282 | addresses = [email.to, email.cc].flatten.compact.uniq.collect {|a| a.strip.downcase} |
|
283 | 283 | unless addresses.empty? |
|
284 |
watchers = User.active. |
|
|
284 | watchers = User.active.where('LOWER(mail) IN (?)', addresses).all | |
|
285 | 285 | watchers.each {|w| obj.add_watcher(w)} |
|
286 | 286 | end |
|
287 | 287 | end |
@@ -252,7 +252,7 class Mailer < ActionMailer::Base | |||
|
252 | 252 | # Mailer.account_activation_request(user).deliver => sends an email to all active administrators |
|
253 | 253 | def account_activation_request(user) |
|
254 | 254 | # Send the email to all active administrators |
|
255 |
recipients = User.active. |
|
|
255 | recipients = User.active.where(:admin => true).all.collect { |u| u.mail }.compact | |
|
256 | 256 | @user = user |
|
257 | 257 | @url = url_for(:controller => 'users', :action => 'index', |
|
258 | 258 | :status => User::STATUS_REGISTERED, |
@@ -54,7 +54,7 class MemberRole < ActiveRecord::Base | |||
|
54 | 54 | end |
|
55 | 55 | |
|
56 | 56 | def remove_role_from_group_users |
|
57 |
MemberRole. |
|
|
57 | MemberRole.where(:inherited_from => id).all.group_by(&:member).each do |member, member_roles| | |
|
58 | 58 | member_roles.each(&:destroy) |
|
59 | 59 | if member && member.user |
|
60 | 60 | Watcher.prune(:user => member.user, :project => member.project) |
@@ -138,7 +138,7 class Project < ActiveRecord::Base | |||
|
138 | 138 | # returns latest created projects |
|
139 | 139 | # non public projects will be returned only if user is a member of those |
|
140 | 140 | def self.latest(user=nil, count=5) |
|
141 |
visible(user). |
|
|
141 | visible(user).limit(count).order("created_on DESC").all | |
|
142 | 142 | end |
|
143 | 143 | |
|
144 | 144 | # Returns true if the project is visible to +user+ or to the current user. |
@@ -338,7 +338,7 class Project < ActiveRecord::Base | |||
|
338 | 338 | # by the current user |
|
339 | 339 | def allowed_parents |
|
340 | 340 | return @allowed_parents if @allowed_parents |
|
341 |
@allowed_parents = Project. |
|
|
341 | @allowed_parents = Project.where(Project.allowed_to_condition(User.current, :add_subprojects)).all | |
|
342 | 342 | @allowed_parents = @allowed_parents - self_and_descendants |
|
343 | 343 | if User.current.allowed_to?(:add_project, nil, :global => true) || (!new_record? && parent.nil?) |
|
344 | 344 | @allowed_parents << nil |
@@ -415,7 +415,7 class Project < ActiveRecord::Base | |||
|
415 | 415 | # Closes open and locked project versions that are completed |
|
416 | 416 | def close_completed_versions |
|
417 | 417 | Version.transaction do |
|
418 |
versions. |
|
|
418 | versions.where(:status => %w(open locked)).all.each do |version| | |
|
419 | 419 | if version.completed? |
|
420 | 420 | version.update_attribute(:status, 'closed') |
|
421 | 421 | end |
@@ -452,7 +452,7 class Project < ActiveRecord::Base | |||
|
452 | 452 | |
|
453 | 453 | # Returns a hash of project users grouped by role |
|
454 | 454 | def users_by_role |
|
455 |
members. |
|
|
455 | members.includes(:user, :roles).all.inject({}) do |h, m| | |
|
456 | 456 | m.roles.each do |r| |
|
457 | 457 | h[r] ||= [] |
|
458 | 458 | h[r] << m.user |
@@ -786,7 +786,7 class Project < ActiveRecord::Base | |||
|
786 | 786 | |
|
787 | 787 | # Get issues sorted by root_id, lft so that parent issues |
|
788 | 788 | # get copied before their children |
|
789 |
project.issues. |
|
|
789 | project.issues.reorder('root_id, lft').all.each do |issue| | |
|
790 | 790 | new_issue = Issue.new |
|
791 | 791 | new_issue.copy_from(issue, :subtasks => false, :link => false) |
|
792 | 792 | new_issue.project = self |
@@ -929,13 +929,11 class Project < ActiveRecord::Base | |||
|
929 | 929 | def system_activities_and_project_overrides(include_inactive=false) |
|
930 | 930 | if include_inactive |
|
931 | 931 | return TimeEntryActivity.shared. |
|
932 | find(:all, | |
|
933 | :conditions => ["id NOT IN (?)", self.time_entry_activities.collect(&:parent_id)]) + | |
|
932 | where("id NOT IN (?)", self.time_entry_activities.collect(&:parent_id)).all + | |
|
934 | 933 | self.time_entry_activities |
|
935 | 934 | else |
|
936 | 935 | return TimeEntryActivity.shared.active. |
|
937 | find(:all, | |
|
938 | :conditions => ["id NOT IN (?)", self.time_entry_activities.collect(&:parent_id)]) + | |
|
936 | where("id NOT IN (?)", self.time_entry_activities.collect(&:parent_id)).all + | |
|
939 | 937 | self.time_entry_activities.active |
|
940 | 938 | end |
|
941 | 939 | end |
@@ -218,7 +218,7 class Query < ActiveRecord::Base | |||
|
218 | 218 | end |
|
219 | 219 | |
|
220 | 220 | def trackers |
|
221 |
@trackers ||= project.nil? ? Tracker. |
|
|
221 | @trackers ||= project.nil? ? Tracker.sorted.all : project.rolled_up_trackers | |
|
222 | 222 | end |
|
223 | 223 | |
|
224 | 224 | # Returns a hash of localized labels for all filter operators |
@@ -231,7 +231,7 class Query < ActiveRecord::Base | |||
|
231 | 231 | @available_filters = { |
|
232 | 232 | "status_id" => { |
|
233 | 233 | :type => :list_status, :order => 0, |
|
234 |
:values => IssueStatus. |
|
|
234 | :values => IssueStatus.sorted.all.collect{|s| [s.name, s.id.to_s] } | |
|
235 | 235 | }, |
|
236 | 236 | "tracker_id" => { |
|
237 | 237 | :type => :list, :order => 2, :values => trackers.collect{|s| [s.name, s.id.to_s] } |
@@ -344,12 +344,7 class Query < ActiveRecord::Base | |||
|
344 | 344 | } |
|
345 | 345 | } |
|
346 | 346 | end |
|
347 | add_custom_fields_filters( | |
|
348 | IssueCustomField.find(:all, | |
|
349 | :conditions => { | |
|
350 | :is_filter => true, | |
|
351 | :is_for_all => true | |
|
352 | })) | |
|
347 | add_custom_fields_filters(IssueCustomField.where(:is_filter => true, :is_for_all => true).all) | |
|
353 | 348 | end |
|
354 | 349 | add_associations_custom_fields_filters :project, :author, :assigned_to, :fixed_version |
|
355 | 350 | if User.current.allowed_to?(:set_issues_private, nil, :global => true) || |
@@ -455,7 +450,7 class Query < ActiveRecord::Base | |||
|
455 | 450 | @available_columns = ::Query.available_columns.dup |
|
456 | 451 | @available_columns += (project ? |
|
457 | 452 | project.all_issue_custom_fields : |
|
458 |
IssueCustomField. |
|
|
453 | IssueCustomField.all | |
|
459 | 454 | ).collect {|cf| QueryCustomFieldColumn.new(cf) } |
|
460 | 455 | |
|
461 | 456 | if User.current.allowed_to?(:view_time_entries, project, :global => true) |
@@ -337,7 +337,7 class Repository < ActiveRecord::Base | |||
|
337 | 337 | |
|
338 | 338 | # scan changeset comments to find related and fixed issues for all repositories |
|
339 | 339 | def self.scan_changesets_for_issue_ids |
|
340 |
|
|
|
340 | all.each(&:scan_changesets_for_issue_ids) | |
|
341 | 341 | end |
|
342 | 342 | |
|
343 | 343 | def self.scm_name |
@@ -92,11 +92,12 class Repository::Mercurial < Repository | |||
|
92 | 92 | # Sqlite3 and PostgreSQL pass. |
|
93 | 93 | # Is this MySQL bug? |
|
94 | 94 | def latest_changesets(path, rev, limit=10) |
|
95 |
changesets. |
|
|
96 | :include => :user, | |
|
97 |
|
|
|
98 | :limit => limit, | |
|
99 |
|
|
|
95 | changesets. | |
|
96 | includes(:user). | |
|
97 | where(latest_changesets_cond(path, rev, limit)). | |
|
98 | limit(limit). | |
|
99 | order("#{Changeset.table_name}.id DESC"). | |
|
100 | all | |
|
100 | 101 | end |
|
101 | 102 | |
|
102 | 103 | def latest_changesets_cond(path, rev, limit) |
@@ -29,7 +29,7 class Watcher < ActiveRecord::Base | |||
|
29 | 29 | prune_single_user(options[:user], options) |
|
30 | 30 | else |
|
31 | 31 | pruned = 0 |
|
32 |
User. |
|
|
32 | User.where("id IN (SELECT DISTINCT user_id FROM #{table_name})").all.each do |user| | |
|
33 | 33 | pruned += prune_single_user(user, options) |
|
34 | 34 | end |
|
35 | 35 | pruned |
@@ -47,7 +47,7 class Watcher < ActiveRecord::Base | |||
|
47 | 47 | def self.prune_single_user(user, options={}) |
|
48 | 48 | return unless user.is_a?(User) |
|
49 | 49 | pruned = 0 |
|
50 |
|
|
|
50 | where(:user_id => user.id).all.each do |watcher| | |
|
51 | 51 | next if watcher.watchable.nil? |
|
52 | 52 | |
|
53 | 53 | if options.has_key?(:project) |
@@ -1,5 +1,5 | |||
|
1 | 1 | <% roles = Role.find_all_givable %> |
|
2 |
<% projects = Project.active. |
|
|
2 | <% projects = Project.active.all %> | |
|
3 | 3 | |
|
4 | 4 | <div class="splitcontentleft"> |
|
5 | 5 | <% if @group.memberships.any? %> |
@@ -1,6 +1,6 | |||
|
1 | 1 | <%= error_messages_for 'member' %> |
|
2 | 2 | <% roles = Role.find_all_givable |
|
3 |
members = @project.member_principals. |
|
|
3 | members = @project.member_principals.includes(:roles, :principal).all.sort %> | |
|
4 | 4 | |
|
5 | 5 | <div class="splitcontentleft"> |
|
6 | 6 | <% if members.any? %> |
@@ -68,7 +68,7 | |||
|
68 | 68 | <p><%= setting_text_field :commit_fix_keywords, :size => 30 %> |
|
69 | 69 | <%= l(:label_applied_status) %>: <%= setting_select :commit_fix_status_id, |
|
70 | 70 | [["", 0]] + |
|
71 |
IssueStatus. |
|
|
71 | IssueStatus.sorted.all.collect{ | |
|
72 | 72 | |status| [status.name, status.id.to_s] |
|
73 | 73 | }, |
|
74 | 74 | :label => false %> |
@@ -1,5 +1,5 | |||
|
1 | 1 | <% roles = Role.find_all_givable %> |
|
2 |
<% projects = Project.active. |
|
|
2 | <% projects = Project.active.all %> | |
|
3 | 3 | |
|
4 | 4 | <div class="splitcontentleft"> |
|
5 | 5 | <% if @user.memberships.any? %> |
@@ -44,8 +44,7 module Redmine | |||
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | def available_custom_fields |
|
47 |
CustomField. |
|
|
48 | :order => 'position') | |
|
47 | CustomField.where("type = '#{self.class.name}CustomField'").sorted.all | |
|
49 | 48 | end |
|
50 | 49 | |
|
51 | 50 | # Sets the values of the object's custom fields |
@@ -139,15 +139,15 module Redmine | |||
|
139 | 139 | rejected = IssueStatus.create!(:name => l(:default_issue_status_rejected), :is_closed => true, :is_default => false, :position => 6) |
|
140 | 140 | |
|
141 | 141 | # Workflow |
|
142 |
Tracker. |
|
|
143 |
IssueStatus. |
|
|
144 |
IssueStatus. |
|
|
142 | Tracker.all.each { |t| | |
|
143 | IssueStatus.all.each { |os| | |
|
144 | IssueStatus.all.each { |ns| | |
|
145 | 145 | WorkflowTransition.create!(:tracker_id => t.id, :role_id => manager.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns |
|
146 | 146 | } |
|
147 | 147 | } |
|
148 | 148 | } |
|
149 | 149 | |
|
150 |
Tracker. |
|
|
150 | Tracker.all.each { |t| | |
|
151 | 151 | [new, in_progress, resolved, feedback].each { |os| |
|
152 | 152 | [in_progress, resolved, feedback, closed].each { |ns| |
|
153 | 153 | WorkflowTransition.create!(:tracker_id => t.id, :role_id => developer.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns |
@@ -155,7 +155,7 module Redmine | |||
|
155 | 155 | } |
|
156 | 156 | } |
|
157 | 157 | |
|
158 |
Tracker. |
|
|
158 | Tracker.all.each { |t| | |
|
159 | 159 | [new, in_progress, resolved, feedback].each { |os| |
|
160 | 160 | [closed].each { |ns| |
|
161 | 161 | WorkflowTransition.create!(:tracker_id => t.id, :role_id => reporter.id, :old_status_id => os.id, :new_status_id => ns.id) unless os == ns |
@@ -144,14 +144,14 module Redmine | |||
|
144 | 144 | end if @project |
|
145 | 145 | |
|
146 | 146 | # Add list and boolean time entry custom fields |
|
147 |
TimeEntryCustomField. |
|
|
147 | TimeEntryCustomField.all.select {|cf| %w(list bool).include? cf.field_format }.each do |cf| | |
|
148 | 148 | @available_criteria["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'TimeEntry' AND c.customized_id = #{TimeEntry.table_name}.id ORDER BY c.value LIMIT 1)", |
|
149 | 149 | :format => cf.field_format, |
|
150 | 150 | :label => cf.name} |
|
151 | 151 | end |
|
152 | 152 | |
|
153 | 153 | # Add list and boolean time entry activity custom fields |
|
154 |
TimeEntryActivityCustomField. |
|
|
154 | TimeEntryActivityCustomField.all.select {|cf| %w(list bool).include? cf.field_format }.each do |cf| | |
|
155 | 155 | @available_criteria["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM #{CustomValue.table_name} c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'Enumeration' AND c.customized_id = #{TimeEntry.table_name}.activity_id ORDER BY c.value LIMIT 1)", |
|
156 | 156 | :format => cf.field_format, |
|
157 | 157 | :label => cf.name} |
@@ -53,7 +53,7 task :migrate_from_mantis => :environment do | |||
|
53 | 53 | TRACKER_BUG = Tracker.find_by_position(1) |
|
54 | 54 | TRACKER_FEATURE = Tracker.find_by_position(2) |
|
55 | 55 | |
|
56 |
roles = Role. |
|
|
56 | roles = Role.where(:builtin => 0).order('position ASC').all | |
|
57 | 57 | manager_role = roles[0] |
|
58 | 58 | developer_role = roles[1] |
|
59 | 59 | DEFAULT_ROLE = roles.last |
@@ -241,7 +241,7 task :migrate_from_mantis => :environment do | |||
|
241 | 241 | User.delete_all "login <> 'admin'" |
|
242 | 242 | users_map = {} |
|
243 | 243 | users_migrated = 0 |
|
244 |
MantisUser. |
|
|
244 | MantisUser.all.each do |user| | |
|
245 | 245 | u = User.new :firstname => encode(user.firstname), |
|
246 | 246 | :lastname => encode(user.lastname), |
|
247 | 247 | :mail => user.email, |
@@ -263,7 +263,7 task :migrate_from_mantis => :environment do | |||
|
263 | 263 | projects_map = {} |
|
264 | 264 | versions_map = {} |
|
265 | 265 | categories_map = {} |
|
266 |
MantisProject. |
|
|
266 | MantisProject.all.each do |project| | |
|
267 | 267 | p = Project.new :name => encode(project.name), |
|
268 | 268 | :description => encode(project.description) |
|
269 | 269 | p.identifier = project.identifier |
@@ -365,7 +365,7 task :migrate_from_mantis => :environment do | |||
|
365 | 365 | |
|
366 | 366 | # Bug relationships |
|
367 | 367 | print "Migrating bug relations" |
|
368 |
MantisBugRelationship. |
|
|
368 | MantisBugRelationship.all.each do |relation| | |
|
369 | 369 | next unless issues_map[relation.source_bug_id] && issues_map[relation.destination_bug_id] |
|
370 | 370 | r = IssueRelation.new :relation_type => RELATION_TYPE_MAPPING[relation.relationship_type] |
|
371 | 371 | r.issue_from = Issue.find_by_id(issues_map[relation.source_bug_id]) |
@@ -379,7 +379,7 task :migrate_from_mantis => :environment do | |||
|
379 | 379 | # News |
|
380 | 380 | print "Migrating news" |
|
381 | 381 | News.destroy_all |
|
382 |
MantisNews. |
|
|
382 | MantisNews.where('project_id > 0').all.each do |news| | |
|
383 | 383 | next unless projects_map[news.project_id] |
|
384 | 384 | n = News.new :project_id => projects_map[news.project_id], |
|
385 | 385 | :title => encode(news.headline[0..59]), |
@@ -395,7 +395,7 task :migrate_from_mantis => :environment do | |||
|
395 | 395 | # Custom fields |
|
396 | 396 | print "Migrating custom fields" |
|
397 | 397 | IssueCustomField.destroy_all |
|
398 |
MantisCustomField. |
|
|
398 | MantisCustomField.all.each do |field| | |
|
399 | 399 | f = IssueCustomField.new :name => field.name[0..29], |
|
400 | 400 | :field_format => CUSTOM_FIELD_TYPE_MAPPING[field.format], |
|
401 | 401 | :min_length => field.length_min, |
@@ -407,7 +407,7 task :migrate_from_mantis => :environment do | |||
|
407 | 407 | print '.' |
|
408 | 408 | STDOUT.flush |
|
409 | 409 | # Trackers association |
|
410 |
f.trackers = Tracker. |
|
|
410 | f.trackers = Tracker.all | |
|
411 | 411 | |
|
412 | 412 | # Projects association |
|
413 | 413 | field.projects.each do |project| |
@@ -61,7 +61,7 namespace :redmine do | |||
|
61 | 61 | 'patch' =>TRACKER_FEATURE |
|
62 | 62 | } |
|
63 | 63 | |
|
64 |
roles = Role. |
|
|
64 | roles = Role.where(:builtin => 0).order('position ASC').all | |
|
65 | 65 | manager_role = roles[0] |
|
66 | 66 | developer_role = roles[1] |
|
67 | 67 | DEFAULT_ROLE = roles.last |
@@ -390,7 +390,7 namespace :redmine do | |||
|
390 | 390 | # Components |
|
391 | 391 | print "Migrating components" |
|
392 | 392 | issues_category_map = {} |
|
393 |
TracComponent. |
|
|
393 | TracComponent.all.each do |component| | |
|
394 | 394 | print '.' |
|
395 | 395 | STDOUT.flush |
|
396 | 396 | c = IssueCategory.new :project => @target_project, |
@@ -404,7 +404,7 namespace :redmine do | |||
|
404 | 404 | # Milestones |
|
405 | 405 | print "Migrating milestones" |
|
406 | 406 | version_map = {} |
|
407 |
TracMilestone. |
|
|
407 | TracMilestone.all.each do |milestone| | |
|
408 | 408 | print '.' |
|
409 | 409 | STDOUT.flush |
|
410 | 410 | # First we try to find the wiki page... |
@@ -443,7 +443,7 namespace :redmine do | |||
|
443 | 443 | :field_format => 'string') |
|
444 | 444 | |
|
445 | 445 | next if f.new_record? |
|
446 |
f.trackers = Tracker. |
|
|
446 | f.trackers = Tracker.all | |
|
447 | 447 | f.projects << @target_project |
|
448 | 448 | custom_field_map[field.name] = f |
|
449 | 449 | end |
@@ -454,7 +454,7 namespace :redmine do | |||
|
454 | 454 | r = IssueCustomField.new(:name => 'Resolution', |
|
455 | 455 | :field_format => 'list', |
|
456 | 456 | :is_filter => true) if r.nil? |
|
457 |
r.trackers = Tracker. |
|
|
457 | r.trackers = Tracker.all | |
|
458 | 458 | r.projects << @target_project |
|
459 | 459 | r.possible_values = (r.possible_values + %w(fixed invalid wontfix duplicate worksforme)).flatten.compact.uniq |
|
460 | 460 | r.save! |
@@ -549,7 +549,7 namespace :redmine do | |||
|
549 | 549 | # Wiki |
|
550 | 550 | print "Migrating wiki" |
|
551 | 551 | if wiki.save |
|
552 |
TracWikiPage. |
|
|
552 | TracWikiPage.order('name, version').all.each do |page| | |
|
553 | 553 | # Do not migrate Trac manual wiki pages |
|
554 | 554 | next if TRAC_WIKI_PAGES.include?(page.name) |
|
555 | 555 | wiki_edit_count += 1 |
@@ -34,7 +34,7 class RolesControllerTest < ActionController::TestCase | |||
|
34 | 34 | assert_template 'index' |
|
35 | 35 | |
|
36 | 36 | assert_not_nil assigns(:roles) |
|
37 |
assert_equal Role. |
|
|
37 | assert_equal Role.order('builtin, position').all, assigns(:roles) | |
|
38 | 38 | |
|
39 | 39 | assert_tag :tag => 'a', :attributes => { :href => '/roles/1/edit' }, |
|
40 | 40 | :content => 'Manager' |
@@ -163,7 +163,7 class RolesControllerTest < ActionController::TestCase | |||
|
163 | 163 | assert_template 'permissions' |
|
164 | 164 | |
|
165 | 165 | assert_not_nil assigns(:roles) |
|
166 |
assert_equal Role. |
|
|
166 | assert_equal Role.order('builtin, position').all, assigns(:roles) | |
|
167 | 167 | |
|
168 | 168 | assert_tag :tag => 'input', :attributes => { :type => 'checkbox', |
|
169 | 169 | :name => 'permissions[3][]', |
@@ -306,7 +306,10 class WorkflowsControllerTest < ActionController::TestCase | |||
|
306 | 306 | |
|
307 | 307 | # Returns an array of status transitions that can be compared |
|
308 | 308 | def status_transitions(conditions) |
|
309 | WorkflowTransition.find(:all, :conditions => conditions, | |
|
310 | :order => 'tracker_id, role_id, old_status_id, new_status_id').collect {|w| [w.old_status, w.new_status_id]} | |
|
309 | WorkflowTransition. | |
|
310 | where(conditions). | |
|
311 | order('tracker_id, role_id, old_status_id, new_status_id'). | |
|
312 | all. | |
|
313 | collect {|w| [w.old_status, w.new_status_id]} | |
|
311 | 314 | end |
|
312 | 315 | end |
@@ -139,7 +139,7 RAW | |||
|
139 | 139 | # link image |
|
140 | 140 | '!logo.gif!:http://foo.bar/' => '<a href="http://foo.bar/"><img src="/attachments/download/3" title="This is a logo" alt="This is a logo" /></a>', |
|
141 | 141 | } |
|
142 |
attachments = Attachment. |
|
|
142 | attachments = Attachment.all | |
|
143 | 143 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) } |
|
144 | 144 | end |
|
145 | 145 |
@@ -367,7 +367,7 class IssueNestedSetTest < ActiveSupport::TestCase | |||
|
367 | 367 | c.reload |
|
368 | 368 | |
|
369 | 369 | assert_equal 5, c.issues.count |
|
370 |
ic1, ic2, ic3, ic4, ic5 = c.issues. |
|
|
370 | ic1, ic2, ic3, ic4, ic5 = c.issues.order('subject').all | |
|
371 | 371 | assert ic1.root? |
|
372 | 372 | assert_equal ic1, ic2.parent |
|
373 | 373 | assert_equal ic1, ic3.parent |
@@ -183,7 +183,7 class ProjectTest < ActiveSupport::TestCase | |||
|
183 | 183 | # 2 active members |
|
184 | 184 | assert_equal 2, @ecookbook.members.size |
|
185 | 185 | # and 1 is locked |
|
186 |
assert_equal 3, Member. |
|
|
186 | assert_equal 3, Member.where('project_id = ?', @ecookbook.id).all.size | |
|
187 | 187 | # some boards |
|
188 | 188 | assert @ecookbook.boards.any? |
|
189 | 189 | |
@@ -693,7 +693,7 class ProjectTest < ActiveSupport::TestCase | |||
|
693 | 693 | |
|
694 | 694 | def test_activities_should_use_the_system_activities |
|
695 | 695 | project = Project.find(1) |
|
696 |
assert_equal project.activities, TimeEntryActivity. |
|
|
696 | assert_equal project.activities, TimeEntryActivity.where(:active => true).all | |
|
697 | 697 | end |
|
698 | 698 | |
|
699 | 699 |
@@ -105,7 +105,7 class RepositoryBazaarTest < ActiveSupport::TestCase | |||
|
105 | 105 | @project.reload |
|
106 | 106 | assert_equal NUM_REV, @repository.changesets.count |
|
107 | 107 | # Remove changesets with revision > 5 |
|
108 |
@repository.changesets. |
|
|
108 | @repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 2} | |
|
109 | 109 | @project.reload |
|
110 | 110 | assert_equal 2, @repository.changesets.count |
|
111 | 111 |
@@ -116,7 +116,7 class RepositoryCvsTest < ActiveSupport::TestCase | |||
|
116 | 116 | assert_equal CHANGESETS_NUM, @repository.changesets.count |
|
117 | 117 | |
|
118 | 118 | # Remove changesets with revision > 3 |
|
119 |
@repository.changesets. |
|
|
119 | @repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 3} | |
|
120 | 120 | @project.reload |
|
121 | 121 | assert_equal 3, @repository.changesets.count |
|
122 | 122 | assert_equal %w|3 2 1|, @repository.changesets.all.collect(&:revision) |
@@ -79,7 +79,7 class RepositoryDarcsTest < ActiveSupport::TestCase | |||
|
79 | 79 | assert_equal NUM_REV, @repository.changesets.count |
|
80 | 80 | |
|
81 | 81 | # Remove changesets with revision > 3 |
|
82 |
@repository.changesets. |
|
|
82 | @repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 3} | |
|
83 | 83 | @project.reload |
|
84 | 84 | assert_equal 3, @repository.changesets.count |
|
85 | 85 |
@@ -102,7 +102,7 class RepositoryMercurialTest < ActiveSupport::TestCase | |||
|
102 | 102 | @project.reload |
|
103 | 103 | assert_equal NUM_REV, @repository.changesets.count |
|
104 | 104 | # Remove changesets with revision > 2 |
|
105 |
@repository.changesets. |
|
|
105 | @repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 2} | |
|
106 | 106 | @project.reload |
|
107 | 107 | assert_equal 3, @repository.changesets.count |
|
108 | 108 |
@@ -47,7 +47,7 class RepositorySubversionTest < ActiveSupport::TestCase | |||
|
47 | 47 | assert_equal NUM_REV, @repository.changesets.count |
|
48 | 48 | |
|
49 | 49 | # Remove changesets with revision > 5 |
|
50 |
@repository.changesets. |
|
|
50 | @repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 5} | |
|
51 | 51 | @project.reload |
|
52 | 52 | assert_equal 5, @repository.changesets.count |
|
53 | 53 |
General Comments 0
You need to be logged in to leave comments.
Login now