Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Commit

Permalink
can now pass an array of values to the has method
Browse files Browse the repository at this point in the history
  • Loading branch information
vann committed Apr 17, 2009
1 parent 7d04477 commit 8b08aa6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/test/spec/rails/convenience.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ module Convenience

# shortcut for should.not.be.nil
# has :page_title => assigns(:page_title).should.not.be.nil
def has(var)
assigns(var).should.not.be.nil
# OR you can also pass an array of values
# has :page_title, :user # => assigns(:page_title).should.not.be.nil
# => assigns(:user).should.not.be.nil
def has(*var)
return assigns(var).should.not.be.nil if var.length == 1
var.each { |v| assigns(v).should.not.be.nil }
end

# shortcut for flash[:type].should.not.be.nil
Expand Down

0 comments on commit 8b08aa6

Please sign in to comment.