[rspec-devel] [ rspec-Feature Requests-13885 ] be_status methods
noreply at rubyforge.org
noreply at rubyforge.org
Mon Nov 19 00:31:18 EST 2007
Feature Requests item #13885, was opened at 2007-09-12 20:11
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=13885&group_id=797
Category: rails plugin
Group: None
Status: Open
Priority: 3
Submitted By: Assaf Arkin (assaf)
Assigned to: Nobody (None)
Summary: be_status methods
Initial Comment:
response.should be_successful or response.should be_missing are nice but not enough. In too many cases I'm looking for response codes that are neither 200 nor 404.
So how about adding all the status symbols as tests methods?
Controller:
head :unauthorized
Spec:
response.should be_unauthorized
Controller:
head :gone
Spec:
response.should be_gone
And so forth. This code will do it for anything using controller (TestResponse) and integration (CgiResponse) tests:
module ActionController
# TestResponse for functional, CgiResponse for integration.
class AbstractResponse
StatusCodes::SYMBOL_TO_STATUS_CODE.each do |symbol, code|
define_method("#{symbol}?") { self.response_code == code } unless instance_methods.include?("#{symbol}?")
end
end
end
----------------------------------------------------------------------
Comment By: Chad Humphries (spicycode)
Date: 2007-11-19 00:31
Message:
Moved to http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/120-13885-be_status-methods#ticket-120-2
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2007-09-23 18:17
Message:
I'll add this if you'll submit it as a patch with specs.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=13885&group_id=797
More information about the rspec-devel
mailing list