Skip to content

Commit

Permalink
Added a comptability layer for Priorities.
Browse files Browse the repository at this point in the history
Redmine core changed how Enumerations are accessed in r2472 so now
we have to check to see which Enumeration API to use.

  #2132
  • Loading branch information
edavis10 committed Feb 18, 2009
1 parent 7dc4a90 commit 4092742
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion app/models/next_issue_filter.rb
Expand Up @@ -5,7 +5,7 @@ class NextIssueFilter

def initialize
self.users = User.active
self.priorities = Enumeration::get_values('IPRI')
self.priorities = get_priorites
self.statuses = IssueStatus.find(:all)
end

Expand All @@ -16,4 +16,14 @@ def each
yield group, items
end
end

private
# Wrapper around Redmine's API since Enumerations changed in r2472
def get_priorites
if Enumeration.respond_to?(:priorities)
return Enumeration::priorities
else
return Enumeration::get_values('IPRI')
end
end
end
2 changes: 1 addition & 1 deletion spec/controllers/stuff_to_do_controller_spec.rb
Expand Up @@ -352,7 +352,7 @@ def post_reorder
@priority1 = mock_model(Enumeration)
@priority2 = mock_model(Enumeration)
priorities = [@priority1, @priority2]
Enumeration.should_receive(:get_values).with('IPRI').and_return(priorities)
Enumeration.should_receive(:priorities).and_return(priorities)

filters = controller.send(:filters_for_view)
filters.priorities.should include(@priority1)
Expand Down

0 comments on commit 4092742

Please sign in to comment.