Skip to content

Commit

Permalink
fix ticket 121 - add parens to assert calls. also, remove 'merb-test'…
Browse files Browse the repository at this point in the history
… require that broke specs
  • Loading branch information
jackdempsey committed Jun 16, 2008
1 parent 926d100 commit a94e924
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions merb_test_unit/lib/asserts/controller_asserts.rb
Expand Up @@ -3,22 +3,22 @@ module Merb::Test::Unit::ControllerAsserts
include Merb::Test::ControllerHelper

def assert_redirect(target)
assert [307, *(300..305)].include?(target.respond_to?(:status) ? target.status : target), redirect_failure_message(target)
assert([307, *(300..305)].include?(target.respond_to?(:status) ? target.status : target), redirect_failure_message(target))
end

def assert_redirect_to(expected, target)
location = target.headers['Location']

assert_redirect(target)
assert_equal expected, location, redirect_to_failure_message(expected, location)
assert_equal(expected, location, redirect_to_failure_message(expected, location))
end

def assert_success(target)
assert (200..207).include?(target.respond_to?(:status) ? target.status : target), success_failure_message(target)
assert((200..207).include?(target.respond_to?(:status) ? target.status : target), success_failure_message(target))
end

def assert_missing(target)
assert (400..417).include?(target.respond_to?(:status) ? target.status : target), missing_failure_message(target)
assert((400..417).include?(target.respond_to?(:status) ? target.status : target), missing_failure_message(target))
end

private
Expand Down
4 changes: 2 additions & 2 deletions merb_test_unit/lib/asserts/hpricot_asserts.rb
Expand Up @@ -39,9 +39,9 @@ def assert_elements(css_query, output = nil, equality = {}, &block)
end

if(equality[:count] != 0)
assert ret, "#{ message } \"#{ css_query }\" with \"#{ equality.inspect }\" was not found."
assert(ret, "#{ message } \"#{ css_query }\" with \"#{ equality.inspect }\" was not found.")
else
assert ret, "#{ message } \"#{ css_query }\" with \"#{ equality.reject{|k,v| k == :count}.inspect }\" was found, but you specified :count => 0."
assert(ret, "#{ message } \"#{ css_query }\" with \"#{ equality.reject{|k,v| k == :count}.inspect }\" was found, but you specified :count => 0.")
end
ret
end
Expand Down
1 change: 0 additions & 1 deletion merb_test_unit/specs/spec_helper.rb
@@ -1,6 +1,5 @@
require 'rubygems'
require "merb-core"
require "merb-test"
require "test/unit"

Merb.start :environment => 'test', :adapter => 'runner'
Expand Down

0 comments on commit a94e924

Please sign in to comment.