Skip to content

Instantly share code, notes, and snippets.

@paul
Created December 2, 2008 21:21
Show Gist options
  • Save paul/31274 to your computer and use it in GitHub Desktop.
Save paul/31274 to your computer and use it in GitHub Desktop.
Merb::ControllerExceptions::STATUS_CODES.each do |name, code|
reason_phrase = name.to_s.split('_').map{|s| s.capitalize}.join(' ')
Spec::Matchers.create("be_#{name}") do
matches do |resp|
@status = resp.status
@status == code
end
message do |not_string, resp|
"Expected response to#{not_string} be " \
"#{code} #{reason_phrase}, " \
"but it was #{@status}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment