Module: Merb::Test::Unit::ControllerAsserts

Includes:
ControllerHelper, Test::Unit::Assertions
Defined in:
lib/asserts/controller_asserts.rb

Instance Method Summary collapse

Instance Method Details

#assert_missing(target) ⇒ Object



20
21
22
# File 'lib/asserts/controller_asserts.rb', line 20

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

#assert_redirect(target) ⇒ Object



5
6
7
# File 'lib/asserts/controller_asserts.rb', line 5

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

#assert_redirect_to(expected, target) ⇒ Object



9
10
11
12
13
14
# File 'lib/asserts/controller_asserts.rb', line 9

def assert_redirect_to(expected, target)
  location = target.headers['Location']
  
  assert_redirect(target)
  assert_equal(expected, location, redirect_to_failure_message(expected, location))
end

#assert_success(target) ⇒ Object



16
17
18
# File 'lib/asserts/controller_asserts.rb', line 16

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