Permalink
Browse files

Use .validate_args to validate states.

  • Loading branch information...
1 parent b866769 commit 4b67c69132fb6686bcdd24a81e21f31a11c7c8e3 @runpaint committed Apr 22, 2009
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/octopi/issue.rb
View
@@ -25,12 +25,10 @@ class Issue < Base
def self.find_all(*args)
repo = args.first
user, repo_name, opts = extract_user_repository(*args)
- validate_args(user => :user, repo_name => :repo)
state = opts[:state] || "open"
state.downcase! if state
-
- raise "State should be either 'open' or 'closed'" unless ['open', 'closed'].include? state
-
+ validate_args(user => :user, repo_name => :repo, state => :state)
+
issues = super user, repo_name, state
issues.each { |i| i.repository = repo } if repo.is_a? Repository
issues

0 comments on commit 4b67c69

Please sign in to comment.