Skip to content
Browse files

Use .validate_args to validate states.

Signed-off-by: Felipe Coury <felipe.coury@gmail.com>
  • Loading branch information...
1 parent 6425c50 commit c40d56a358762b358bc783a9bcf90f1342fe414f @runpaint committed with fcoury Apr 23, 2009
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/octopi/issue.rb
View
6 lib/octopi/issue.rb
@@ -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 c40d56a

Please sign in to comment.
Something went wrong with that request. Please try again.